5 Steps to learning programming easily

Learning programming has never been easy for first-timers. In this blog, we are going to talk about 5 Steps to learning programming easily so that you steadfast your IT career.

Have you still not figured out how you can start your coding career?
Or you have started but stuck in between and do not know how to make it further?

In this article, we are going to focus on exactly this. So, read this article till the end to find out the answer. My personal favorite tip is number 3. Let me know which one you like the most in the comment section.

  1. Choose a language

    You need to start somewhere. So choose a language… any language. Do some research, ask yourself why this specific programming language would be the best for you.
    You can do some basic research on Google that what all can be achieved if you learn this language. Or you can ask people who you already know, preferably to those who have learned this language. But remember do not get carried away by these people as everyone will give some advice. But only few can give you a correct advice.

    From my perspective choose a simple programming language like C. C Language technically does not have much to do with your learning path. But learning it for programming basics will create a strong foundation. It is easy to learn and you can master it in a matter of weeks.

    Or you can use Python, which is my favorite too. The only problem with it is… you might get overwhelmed about what all can be achieved with it. And because you can’t do that all yet, you might start feeling programming as a too distant dream for you. Hence its always better to start small.

    After you choose the language promise yourself “No matter what, I am going to complete learning this language.”

  2. Stick to it till you complete 75% of it at least

    This is again important thing, as… you once start learning a language for the first time, you need to rely much on internal motivation and discipline. As after few days, once you start learning… you come up with questions …Have I really chose the correct language?
    What if I learn this language and it turns out to be non-useful?
    Am I wasting time by learning the language?
    I am learning C-language, but my friends are learning PHP, C#… machine learning
    And Most importantly… will I be able to complete as I planned?

    Then tell yourself…

    I have promised myself that I will complete this language and I will.

  3. Daily dose of code

    Motivation is a very limited resource, it lasts for a while only. And then you need another dose of motivation. Let me explain this by an example… completing 20 lessons in a day does look like a big task and will really require a lot of motivation.

    However, for a simple task like brushing your teeth or checking Facebook messages does not require any motivation, why is that? Because it has become a habit.
    Similarly, if you try to write codes or learning programs as a habit it will become an effortless act. Hence you can promise yourself to understand and write 4 programs a day. Which can take max 45 minutes? That way you will complete 100 programs in 25 days.

    This will be a simpler task and won’t require any motivation. Gradually it forms a habit and sometimes you will even forget that you did 3 programs / 6 programs or even 100 in a single session. You will be so engraved in the process of learning.So, don’t reply to much on motivation, rather form habits which will build interest and a great career later on.

  4. Remembering what can help

    Creating a circle of friends. You may have caught up yourselves with limited or absolutely zero like-minded people. Hence you can join our Facebook communities, WhatsApp groups or YouTube channels and get access to like-minded people.
    Avoid naysayers as they will try to disturb your learning path, in this situation again remember about the promise you made to yourself.

  5. Remeber what cannot help

    Stopping in between. Half knowledge is much more harmful than not knowing anything. As it gives you false confidence that you have learned it, however inside you have the fear of confronting that you do not know it in detail.

    Not letting people know your success or progress you are making throughout your journey. When you share success and progress people will congratulate you and appreciate your efforts, that will make you more confident and motivate you to do more.

    Don’t be a Hitler too and punish yourself with guilt when you skip a session and maybe you are not able to understand a problem. It’s okay, tell yourself things like…Oh, I missed today’s coding session but tomorrow for sure I will make this a priority.

    I am facing difficulty solving or understanding this problem, let me try to put in more efforts else I will seek help from my online communities or take experts advice on this.

    Skipping a coding session is okay but don’t make it a habit.

IMPORTANT Notes

So these are five tips for your journey to learn coding. Apart from these 5 points… there is an important suggestion that can give you to help you learn to code easily.

Based on these tips we at kodegod.com have built a course which has 101 programs which you can learn step by step. The course is concentrated on learning programming logic, which the most important ingredient when you start out learning programming languages, without logic you can’t technically master any programming language or technology. You can register for this course freely and take first 4 modules which consist of 32 lessons at the end of this video which are absolutely free to use.

With the course, you get access to our WhatsApp Group and Facebook Study Groups when you find like-minded people and hence it helps you succeed easily.

This is the link for the course, you can use coupon codes available for additional discounts, you will find the coupons on our blog site.

Most importantly subscribe to our youtube channel and hit the bell icon so get instant notification when we upload similar videos.

Share this video with your all friends so this videos also help them.

Do let me know your suggestions and questions if you have any, using the comment section below.

Thank you so much for watching this video until the end!

101 Programs to build your Programming Logic [using C Programming]

Most college students feel stiff struggle learning programming logic in college days. Below is list 101 C Programs, which will help you build basic concepts of control structures, conditional statements and so on. Programs are written for basic to advance logic building. These programs have been personally written by me 8-9 years back in my graduation days and were quite helpful to me and all my fellow friends. I hope you all too find them useful. Cheers !

  • 001. Write a program to print a string in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
      clrscr();
      printf("nKodeGod.com");
      getch();
    }
  • 002. Write a program to accept values of two numbers and print their addition
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int a,b,c;
     clrscr();
     printf("Enter number 1: ");
     scanf("%d",&a);
     printf("Enter number 2: ");
     scanf("%d",&b);
     c=a+b;
     printf("Addition is   : %d",c);
     getch();
    }
  • 003. Write a program to accept values of two numbers and print their subtraction
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int a,b,c;
     clrscr();
     printf("Enter number 1: ");
     scanf("%d",&a);
     printf("Enter number 2: ");
     scanf("%d",&b);
     c=a-b;
     printf("Subtraction   : %d",c);
     getch();
    }
  • 004. Write a program to accept values of two numbers and print their multiplication in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int a,b,c;
     clrscr();
     printf("Enter number 1: ");
     scanf("%d",&a);
     printf("Enter number 2: ");
     scanf("%d",&b);
     c=a*b;
     printf("Multiplication: %d",c);
     getch();
    }
  • 005. Write a program to accept values of two numbers and print their division in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     float a,b,c;
     clrscr();
     printf("Enter number 1: ");
     scanf("%f",&a);
     printf("Enter number 2: ");
     scanf("%f",&b);
     c=a/b;
     printf("Division is   : %f",c);
     getch();
    }
  • 006. Write a program to print area of a circle. A(circle)= 3.142 * R * R in C language
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     float AREA,R;
     clrscr();
     printf("Enter Radius: ");
     scanf("%f",&R);
     AREA=3.14*R*R;
     printf("Area of the given is : %6.2f",AREA);
     getch();
    }
  • 007. Write a program to print area of a triangle A(Triangle)= 0.5 * B * H in C language
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     float AREA,B,H;
     clrscr();
     printf("Enter Base & Height: ");
     scanf("%f%f",&B,&H);
     AREA=0.5*B*H;
     printf("Area of the given is : %6.2f",AREA);
     getch();
    }
  • 008. Write a program to print simple interest SI = (PNR)/100 in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     float SI,P,N,R;
     clrscr();
     printf("Enter values of P, N and R: ");
     scanf("%f%f%f",&P,&N,&R);
     SI=(P*N*R)/100;
     printf("Simple interest = : %6.2f",SI);
     getch();
    }
  • 009. Write a program to accept a number from user and print it’s square & cube in C language
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
     int n, Square, Cube;
     clrscr();
     printf("Enter Number: ");
     scanf("%d",&amp;n);
     Square=n*n;
     Cube=n*n*n;
     printf("nSquare: %dnCube: %d",Square,Cube);
     getch();
    }
  • 010. Write a program to accept two values a & b and interchange their values in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
     int a, b, temp;
     clrscr();
     printf("Enter Numbers: ");
     scanf("%d%d",&a,&b);
     printf("nBefore Swapping..na=%d,b=%d",a,b); 
     temp=a;
     a=b;
     b=temp;
     printf("nAfter Swapping..na=%d,b=%d",a,b);
     getch();
    }
  • 011. Write a program to accept roll no and marks of 3 subjects of a student, Calculate total of 3 subjects and average in C language
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
      int roll_no,m1,m2,m3,total;
      float average;
      clrscr();
      printf("Enter roll number : ");
      scanf("%d",&roll_no);
      printf("Enter marks 1 : "); 
      scanf("%d",&m1);
      printf("Enter marks 2 : ");
      scanf("%d",&m2);
      printf("Enter marks 3 : ");
      scanf("%d",&m3);
      total=m1+m2+m3;
      average=total/3.0;
      printf("nStudent Roll Number : %d",roll_no);
      printf("nMarks 1 : %d",m1);
      printf("nMarks 2 : %d",m2);
      printf("nMarks 3 : %d",m3);
      printf("nTotal : %d ",total);
      printf("nAverage : %f ",average);
      getch();
    }
  • 012. Print following outputs: http:\\www.kodegod.com\new in C language
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
     clrscr();
     printf("http:\\www.kodegod.com\learn-programming");
     getch(); 
    }
  • 013. Print the following output in C Language

    #include<stdio.h>
    #include<conio.h>
     main()
     {
      clrscr();
      printf("n");
      printf("   /\        n");
      printf("  //\\      n");
      printf(" ///\\\    n");
      printf("////\\\\  n");
      printf("  |||         n");
      printf("  |||         n");
      getch();
     }
  • 014. Write a program to accept two number and print largest among them in C language
     
    #include<stdio.h>
     
    #include<conio.h>
     
    main()
     
    {
     
    int a,b;
     
    clrscr();
     
    printf("Enter numbers : ");
     
    scanf("%d%d",&a,&b);
     
    if(a>b)
     
    printf("Largest value is....%d",a);
     
    else
     
    printf("Largest value is....%d",b);
     
    getch();
     
    }
  • 015. Write a program to accept a number and print if the number is Positive/Negative in C language
    #include<stdio.h>
    #include<conio.h>
     
    main()
    {
     int n;
     clrscr();
     printf("Enter number..");
     scanf("%d",&n);
     if(n>0)
    	printf("Given number is positive");
     else if(n<0)
    	printf("Given number is negative");
     else
    	printf("Number is Zero");
     getch();
    }
  • 016. Write a program to accept a number and check if it is >10, <10 or =10 in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
      int n;
      clrscr();
      printf("enter number...");
      scanf("%d",&n);
      if(n>10)
    	printf("Number is greater than 10");
      else if(n<10)
    	printf("Number is lesser than 10");
      else
    	printf("Number is 10");
      getch();
    }
  • 017. Write a program to accept a number from user and print if it is even or odd in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n;
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     if(n%2==0)
    	printf("Number is even...");
     else
    	printf("Number is odd....");
     getch();
    }
  • 018. Write a program to accept a number from user and print if it is divisible by 5 in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n;
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     if(n%5==0)
    	printf("Number is divisible by 5.");
     else
    	printf("Number is not divisible by 5.");
     getch();
    }
  • 019. Write a program to accept a number from user and print if it is multiple of 7 in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n;
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     if(n%7==0)
    	printf("Number is multiple of 7");
     else
    	printf("Number is not multiple of 7");
     getch();
    }
  • 020. Write a program to accept two numbers from user and compare them in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int a,b;
     clrscr();
     printf("Enter numbers...");
     scanf("%d%d",&a,&b);
     if(a>b)
    	printf("a is greater than b");
     else if(b>a)
    	printf("b is greater than a");
     else
    	printf("both are equal");
     getch();
    }
  • 021. Write a program to accept three numbers from user and print them in ascending and decending order in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
     int a,b,c;
     clrscr();
     printf("Enter numbers...");
     scanf("%d%d%d",&a,&b,&c);
     if((a>=b)&&(a>=c))
     {
        if(b>=c)
        {
         printf("n Descending order : %d %d %d",a,b,c);
         printf("n Ascending order : %d %d %d",c,b,a);
        }
        else
        {
         printf("n Descending order : %d %d %d",a,c,b);
         printf("n Ascending order : %d %d %d",b,c,a);
        }
     }
     else if((b>=a)&&(b>=c))
     {
        if(a>=c)
        {
         printf("n Descending order : %d %d %d",b,a,c);
         printf("n Ascending order : %d %d %d",c,a,b);
        }
        else
        {
         printf("n Descending order : %d %d %d",b,c,a);
         printf("n Ascending order : %d %d %d",a,c,b);
        }
     }
     else if((c>=a)&&(c>=b))
     {
      if(a>=b)
      {
         printf(" Descending order : %d %d %d",c,a,b);
         printf(" Ascending order : %d %d %d",b,a,c);
      }
      else
      {
         printf(" Descending order : %d %d %d",c,b,a);
         printf(" Ascending order : %d %d %d",a,b,c);
      }
    }
     getch();
    }
  • 022. Write a program to calculate roots of a quadratic equations in C language

    x=b^2-4ac
    if x=0 -> only one root ,
    if x>0 -> roots are distinct (–b+x)/2a & (–b-x)/2a
    if x<0 -> roots are imaginary

    #include<stdio.h>
    #include<conio.h>
    main()
    {
     float x,r1,r2,a,b,c;
     clrscr();
     printf("Enter a,b,c...");
     scanf("%f%f%f",&a,&b,&c);
     x=b*b-4*a*c;
     r1=(-b+x)/2*a;
     r2=(-b-x)/2*a;
     if(x>0)
    		printf("nRoots are unequal...n");
     else if(x<0)
    		printf("nRoots are imaginary...n");
     else
    		printf("nRoots are same....n");
     printf("R1 = %f",r1);
     printf("R2 = %f",r2);
     getch();
    }
  • 023. Write a program to accept roll number ,and marks for three subjects, print total marks and average, also print grade by considering following conditions

    Avg>=60 Grade A
    Avg<60,Avg >=50 Grade B
    Avg<50,Avg >=40 Grade C

    Grade F.

    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int RollNumber,m1,m2,m3,total;
     float avg;
     clrscr();
     printf("Enter Roll Number : ");
     scanf("%d",&RollNumber);
     printf("Enter marks for three subjects : ");
     scanf("%d%d%d",&m1,&m2,&m3);
     total=m1+m2+m3;
     avg=total/3.0;
     printf("nTotal is....... %d",total);
     printf("nAverage is..... %5.2f %",avg);
     if(avg>=60)
    	printf("nGrade : A");
    else if((avg>=50)&&(avg<60))
    	printf("nGrade : B");
     else if((avg>=40)&&(avg<50))
    	printf("nGrade : C");
     else
    	printf("nGrade : F");
     getch();
    }
  • 024. Write a Program to accept user’s marital status, gender and age to check if he/she is eligible for marriage or not.
    #include<stdio.h>
    #include<conio.h>
    main()
    {
       int age;
       char MaritalStatus,Gender;
       clrscr();
     printf("Enter MaritalStatus, Gender, Age : (e.g. m,f,25) : ");
       scanf("%c,%c,%d",&MaritalStatus,&Gender,&age);
       if(MaritalStatus=='m')
       {
    		printf("You can not marry!");
       }
       else if(MaritalStatus=='u')
       {
    		if(Gender=='m')
    		{
    			if(age>=21)
    			    printf("You can marry!");
    			else
    			    printf("You can not marry!");
    		}
    		else if(Gender=='f')
    		{
    			if(age>=18)
    			    printf("You can marry!");
    			else
    			    printf("You can not marry!");
    		}
    		else
    		      printf("Invalid input Gender");
       }
       else
    printf("Invalid input Marital Status ");
       getch();
    }
  • 025. Write a Program to print numbers 1 to n using while loop in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
      int i=1,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      while(i<=n)
      {
    	   printf("%dt",i);
    	   i++;
      }
      getch();
    }
  • 026. Write a Program to print numbers n to 1 using Do While loop in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
      int i=1,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      i=n;
      do
      {
    	   printf("%dt",i);
    	   i--;
      }while(i>=1);
      getch();
    }
  • 027. Write a Program to print first n even numbers in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
      int i=2,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      while(i<=n)
      {
    	   printf("%dt",i);
    	   i=i+2;
      }
      getch();
    }
  • 028. Write a Program to print first n odd numbers in C language
    #include<stdio.h>
    #include<conio.h> 
    main()
    {
      int i=1,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      while(i<=n)
      {
    	   printf("%dt",i);
    	   i=i+2;
      }
      getch();
    }
  • 029. Write a Program to accept a number and print the number in reverse order. E.g. if 1324 is the number then the output will be 4231 in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
      int rem,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      while(n>0)
      {
    	   rem=n%10;
    	   printf("%d",rem);
    	   n=n/10;
      }
      getch();
    }
  • 030. Write a Program to accept a number and print sum of it’s digits in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
      int rem,sum=0,n
      clrscr();
      printf("Enter n : ");
      scanf("%d",&n);
      while(n>0)
      {
    	   rem=n%10;
    	   sum=sum+rem;
    	   n=n/10;
      }
      printf("Sum of digits....%d",sum);
      getch();
    }
  • 031. Write a program to accept a number from user and check it it is Armstrong number or not i.e. 153 = 1^3 + 5^3 + 3^3 = 153 in C language
    #include
    #include
    main()
    {
      int temp,rem,sum=0,n;
      clrscr();
      printf("Enter n : ");
      scanf("%d", &n);
      temp=n;
      while(n > 0)
      {
    	   rem=n%10;
    	   sum=sum+rem*rem*rem;
    	   n=n/10;
      }
      if(temp==sum)
    		printf("Armstrong Number");
      else
    		printf("Not an Armstrong Number");
      getch();
    }
  • 032. Write a program to print table of a given number n in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    { 
     int i,n;
     clrscr();
     printf("Enter number : ");
     scanf("%d",&n);
     for(i=1;i<=10;i++)
    	printf("%d X %d = %dn",n,i,n*i);
     getch();
    }
  • 033. Write a program to print sum of given first n numbers in C language
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
     int n,newn,i,sum=0;
     clrscr();
     printf("Enter number : ");
     scanf("%d",&n);
     printf("Numbers entered....n");
     for(i=1;i<=n;i++)
     {
    	scanf("%d",&newn);
    	sum=sum+newn;
     }
     printf("Sum of given n digits is... %d",sum);
    }
  • 034. Write a program to print following outputs in C language
    * * * * * *
    * * * * * *
    * * * * * *
    * * * * * *
    * * * * * *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(j=1;j<=n;j++)
    			{
    			 printf("*");
    			}
    		printf("n");
    	}
    	getch();
    }
  • 035. Write a program to print following outputs in C language
    *
    * *
    * * *
    * * * *
    * * * * *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		printf("n");
    	}
    	getch();
    }
  • 036. Write a program to print following outputs in C language
    * * * * *
    * * * *
    * * *
    * *
    *
    
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
    	int i,j,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=n;i>=1;i--)
    	{
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		printf("n");
    	}
    	getch();
    }
  • 037. Write a program to print following outputs in C language
    * * * * *
      * * * *
        * * *
          * *
            *
    
    #include<stdio.h> 
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(k=1;k<i;k++)
    			{
    			 printf(" ");
    			}
    		for(j=i;j<=n;j++)
    			{
    			 printf("*");
    			}
    		printf("n");
    	}
    	getch();
    }
  • 038. Write a program to print following outputs in C language
            *
          * *
        * * *
      * * * *
    * * * * *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=n;i>=1;i--)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		printf("n");
    	}
    	getch();
    }
  • 039. Write a program to print following outputs in C language
            *
          * * *
        * * * * *
      * * * * * * *
    * * * * * * * * *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		for(j=2;j<=i;j++)
    			{
    			 printf("*");
    			}
     
    		printf("n");
    	}
    	getch();
    }
  • 040. Write a program to print following outputs in C language
    * * * * * * * * *
      * * * * * * *
        * * * * *
          * * *   
            *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=n;i>=1;i--)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		for(j=2;j<=i;j++)
    			{
    			 printf("*");
    	}
     
    		printf("n");
    	}
    	getch();
    }
  • 041. Write a program to print following outputs in C language
            *
          * * *
        * * * * *
      * * * * * * *
    * * * * * * * * *
      * * * * * * *
        * * * * *
          * * *   
            *
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
     
    	for(i=1;i<=n;i++)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		for(j=2;j<=i;j++)
    			{
    			 printf("*");
    			}
     
    		printf("n");
    	}
     
    	for(i=n-1;i>=1;i--)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("*");
    			}
    		for(j=2;j<=i;j++)
    			{
    			 printf("*");
    			}
     
    		printf("n");
    }
    	getch();
    }
  • 042. Write a program to print following outputs in C language
    1
    12
    123
    1234
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(j=1;j<=i;j++)
    			printf("%d",j);			
    		printf("n");
    	}
    	getch();
    }
  • 043. Write a program to print following outputs in C language
    1
    22
    333
    4444
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		for(j=1;j<=i;j++)
    			printf("%d",i);
    		printf("n");
    	}
    	getch();
    }
  • 044. Write a program to print following outputs in C language
       A
      BBB
     CCCCC
    DDDDDDD
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,k,n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	//ASCII Code for 'A' is 65
    	for(i=1;i<=n;i++)
    	{
    		for(k=1;k<=(n-i);k++)
    			{
    			 printf(" ");
    			}
    		for(j=1;j<=i;j++)
    			{
    			 printf("%c",64+i);
    			}
    		for(j=2;j<=i;j++)
    			{
    			 printf("%c",64+i);
    			}
     
    		printf("n");
    	}
    	getch();
    }
  • 045. Write a program to print following outputs in C language
    ABCDEEDCBA
    ABCD  DCBA
    ABC    CBA
    AB      BA
    A        A
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
      int i,n,j,k;
      clrscr();
      printf("Enter number........");
      scanf("%d",&n);
      for(i=n-1;i>=0;i--)
      {
    		for(j=0;j<=i;j++)
    			printf("%c",65+j);
    		for(k=1;k<(n-i);k++)
    			printf("  ");
    		for(j=i;j>=0;j--)
    			printf("%c",65+j);
    	printf("n");
      }
      getch();
    }
  • 046. Write a program to print following outputs in C language
    1
    11
    121
    1231
    12341
    123451
    
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,n;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	for(i=0;i<=n;i++)
    	{
    		for(j=1;j<=i;j++)
    		{
    			printf("%d",j);
    		}
    		printf("1n");
    	}
    	getch();
    }
  • 047. Write a program to accept a number from user and print it’s factorial in C language

    Eg: factorial of 5 is:-
    5! = 5 * 4 * 3 * 2 * 1=120

    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,fact=1,n;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    		fact=fact*i;
    	printf("facttorialof the given number is...%d",fact);
    	getch();
     
    }
  • 048. Write a program to accept a number from user and print if it is prime or not in C language
    #include<conio.h>
    #include<process.h>
    main()
    {
    	int i,n;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	for(i=2;i<=n/2;i++)
    	{
    		if(n%i==0)
    		{
    		printf("Not Prime");
    		getch();
    		exit(0);
    		}
    	}
    	printf("Prime ");
    	getch();
    }
  • 049. Write a program to accept a number and print prime numbers between 2 and n in C language
     
    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
    main()
    {
    	int i,flag=1,n,newn;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	for(newn=2;newn<=n;newn++)
    	{
    		flag=1;
    		for(i=2;i<=newn/2 ;i++)
    		{
    			if(newn%i==0)
    			{
    			flag=0;
    			break;
    			}
    		}
    		if(flag==1)
    			printf("%d ",newn);
    	}
    	getch();
    }
  • 050. Write a program to accept a number and print fibonacci series upto that level in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int pre=1,cur=1,temp,i,n;
            clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	printf("%dt%d",pre,cur);
    	for(i=3;i<=n;i++)
    		{
    		 temp=cur;
    		 cur=pre+cur;
    		 pre=temp;
    		 printf("t%d",cur);
    		}
    	getch();
    }
  • 051. Write a program to print digits, alphabets in capital and lower case in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i;
    	clrscr();
    	for(i=65;i<=90;i++)
    		  printf("%c  ",i);
     
    	printf("nnnn");
    	for(i=97;i<=122;i++)
    		  printf("%c  ",i);
     
    	printf("nnnn");
    	for(i=48;i<=57;i++)
    		  printf("%ct",i);
     
    	getch();
    }
  • 052. Write a program to accept a number n from user and Add n terms of the series in C language

    1/2! + 2/3! + 3/4! + 4/5! + 5/6! + ………

     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,n;
    	float sum=0,fact=1;
    	clrscr();
    	printf("Enter number....");
    	scanf("%d",&n);
    	for(i=1;i<=n;i++)
    	{
    		fact=1;
    		for(j=1;j<=i+1;j++)
    			fact=fact*j;
    	sum=sum+i/fact;
    	}
    	printf("Sum of the series....%f",sum);
    	getch();
    }
  • 053. Write a program to read n numbers (Xi) from the user and print out their average and standard deviation. Formulae are

    Average = (Sum of Xi)/n

     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,i,newn,sum_avg=0;
    	float avg;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("Enter numbers...");
    	for(i=1;i<=n;i++)
    	{
    		scanf("%d",&newn);
    		sum_avg=sum_avg+newn;
    	}
    	avg=sum_avg/(float)n; //Type casting.
     
    	printf("nAverage = %f",avg);
    	getch();
    }
  • 054. Write a program to print out ASCII chart on a single screen (all 256 characters from 0 to 255) in a tabular form. The ASCII code should be followed by the corresponding character in C language
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int i;
     clrscr();
     for(i=0;i<=255;i++)
    	printf("%d-%ct",i,i);
     getch();
    }
  • 055. Write a program to print following output
    ******************************* 
    *                             *
    *                             *  
    *                             *
    *******************************
    
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j;
    	clrscr();
    	for(i=1;i<=80;i++)
    		printf("*");
    	for(i=2;i<=23;i++)
    	{
    		printf("*");
    		for(j=2;j<=79;j++)
    			printf(" ");
    		printf("*");
    	}
    	for(i=1;i<=80;i++)
    		printf("*");
     
    	getch();
     
    }
  • 056. Write a program to print following output

    #include<stdio.h>
    #include<conio.h>
    main()
    {
            int i, j;
            clrscr();
            printf("╔");
            for(i=2;i<=79;i++)
                    printf("═");
            printf("╗");
            for(i=2;i<=24;i++)
            {
                    printf("║");
                    for(j=2;j<=79;j++)
                            printf(" ");
                    printf("║");
            }
            printf("╚");
            for(i=2;i<=79;i++)
                    printf("═");
            printf("╝");
     
            getch();
    }
  • 057. Write a program to accept a single value interger from user and print that integer in words in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n;
    	clrscr();
    	printf("Enter number...");
    	scanf("%1d",&n);  //%1d to scan single integer
    	switch(n)
    	{
    		case 0 : printf("Zero");break;
    		case 1 : printf("One");break;
    		case 2 : printf("Two");break;
    		case 3 : printf("Three");break;
    		case 4 : printf("Four");break;
    		case 5 : printf("Five");break;
    		case 6 : printf("Six");break;
    		case 7 : printf("Seven ");break;
    		case 8 : printf("Eigth ");break;
    		case 9 : printf("Nine ");break;
    	}
    	getch();
    }
  • 058. Write a program to accept a number from user and print that number in words but in reverse order in C language

    E.g. 153 -> THREE FIVE ONE

    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,rem;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	while(n>0)
    	{
    		rem=n%10;
    		switch(rem)
    		{
    		  case 0 : printf("Zero");break;
    		  case 1 : printf("One");break;
    		  case 2 : printf("Two");break;
    		  case 3 : printf("Three");break;
    		  case 4 : printf("Four");break;
    		  case 5 : printf("Five");break;
    		  case 6 : printf("Six");break;
                      case 7 : printf("Seven");break;
    		  case 8 : printf("Eigth");break;
    		  case 9 : printf("Nine");break;
    		}
    		n=n/10;
     
    	}
    	getch();
    }
  • 059. Write a Program to accept two numbers and a operator (+, -, *, / from user and complete that particular operation only in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,rem,a,b;
    	char op;
    	clrscr();
    	printf("Enter Operator(+,-,*,/)...");
    	scanf("%c",&op);
    	printf("Enter numbers...");
    	scanf("%d%d",&a,&b);
    	switch(op)
    	{
    	case '+' : printf("Result : %d ",a+b);break;
    	case '-' : printf("Result : %d ",a-b);break;
    	case '*' : printf("Result : %d ",a*b);break;
    	case '/' : printf("Result : %d ",a/b);break;
    	default  : printf("Invalid operator....");
    	}
    	getch();
    }
  • 060. Write a program to accept two numbers from user and print it’s addition,subtraction,multiplication,division using different functions in C language
     
    #include<stdio.h>
    #include<conio.h>
     
    int add(int x,int y)
    {
     return(x+y);
    }
     
    int sub(int x,int y)
    {
     return(x-y);
    }
     
    int mul(int x,int y)
    {
     return(x*y);
    }
     
    int div(int x,int y)
    {
     return(x/y);
    }
     
    main()
    {
    	int a,b;
    	clrscr();
    	printf("Enter numbers : n");
    	scanf("%d%d",&a,&b);
    	printf("nAddition       : %dn",add(a,b));
    	printf("nSubtraction    : %dn",sub(a,b));
    	printf("nMultiplication : %dn",mul(a,b));
    	printf("nDivision       : %dn",div(a,b));
    getch();
    }
  • 061. Write a program to accept a number from user and print it’s factorial, check if it prime or not , and print it’s fibbonacci series using different functions in C language
     
    #include<stdio.h>
    #include<conio.h>
     
    fact(int x)
    {
    	int i,fact=1;
    	for(i=1;i<=x;i++)
    		fact=fact*i;
    	printf("Factorial is : %d",fact);
    }
     
    IsPrime(int x)
    {
    	int i;
    	for(i=2;i<x-1;i++)
    	{
    		if(x%i==0)
    			{
    			printf("nNot a Prime Numbern");
    			return 0;
    			}
    	}
    	printf("nIt is a Prime numbern");
    }
     
    fibbo(int x)
    {
    	int pre=1,cur=1,i,temp;
    	printf("%d %d",pre,cur);
    	for(i=3;i<=x;i++)
    	{
    		temp=cur;
    		cur=pre+cur;
    		pre=temp;
    		printf(" %d",cur);
    	}
    }
    main()
    {
    	int n;
    	clrscr();
    	printf("Enter number...");
    	scanf("%d",&n);
    	fact(n);
    	IsPrime(n);
    	fibbo(n);
            getch();
    }
  • 062. Write a program to calculate square and cube of a given number in C language
     
    #include<stdio.h>
    #include<conio.h>
     
    int square(int x)
    {
    	return(x*x);
    }
     
    int qube(int x)
    {
    	return(x*x*x);
    }
    main()
    {
    	int n;
    	clrscr();
    	printf("Enter number.....");
    	scanf("%d",&n);
    	printf("nSquare : %dn",square(n));
    	printf("nQube   : %dn",qube(n));
    	qube(n);
    	getch();
    }
  • 063. Write a program to accept two numbers from user and swap their values using call by reference method in C language
    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
     
    swap(int *x ,int *y)
    {
    	int temp;
    	temp=*x;
    	*x=*y;
    	*y=temp;
    }
    main()
    {
    	int a,b;
    	clrscr();
    	printf("Enter numbers : ");
    	scanf("%d%d",&a,&b);
            printf("nBefore Swapping a = %d, b = %dn",a,b);
    	swap(&a,&b);
    	printf("nAfter  Swapping a = %d, b = %dn",a,b);
    	getch();
    }
  • 064. Write a program using recursions for fibbonacci series in C language
     
    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
    fibbo(int pre, int cur ,int x)
    {        int temp;
    	if(x==2)
    	{
    		getch();
    		exit(0);
    	}
    	temp=cur;
    	cur=pre+cur;
    	pre=temp;
    	printf("%d ",cur);
    	fibbo(pre,cur,x-1);
    }
    main()
    {
    	int n,pre=1,cur=1;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("%d %d ",pre,cur);
            fibbo(pre,cur,n);
    	getch();
    }
  • 065. Write a program to print factorial of a given number using recursive function in C language
    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
     
    int fact(int n)
    {
    	int f;
    	if(n==1)
    		return 1;
    	else
    		f=n*fact(n-1);
    	return f;
    }
    main()
    {
    	int n;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("nFactorial is...%dn",fact(n));
    	getch();
    }
  • 066. Write a program to accept a number n from user and then accept n array elements from user and reprint them in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n,i,a[20];
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     printf("Enter array elements :n" );
     for(i=0;i<n;i++)
    	{
    		printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
     for(i=0;i<n;i++)
    		printf("nElement %d : %d",i+1,a[i]);
     getch();
    }
  • 067. Write a program to accept a number n from user and then accept n array elements from user and reprint them in reverse order of inputs in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n,i,a[20];
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     printf("Enter array elements :n" );
     for(i=0;i<n;i++)
    	{
    		printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
     for(i=n-1;i>=0;i--)
    		printf("nElement %d : %d",i+1,a[i]);
     getch();
    }
  • 068. Write a program to accept a number n from user and then accept n array elements from user and print addition of those n array elements in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
     int n,i,a[20],sum=0;
     clrscr();
     printf("Enter number...");
     scanf("%d",&n);
     printf("Enter array elements :n" );
     for(i=0;i<n;i++)
    	{
    		printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
     
     for(i=0;i<n;i++)
    	sum=sum+a[i];
     printf("nSum of given array elements is : %d",sum);
     getch();
    }
  • 069. Write a program to accept a number n from user and print fibbonacci series up to nth level using arrays in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int a[20],n,i;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	a[1]=a[2]=1;
     
    	for(i=3;i<=n;i++)
    		a[i]=a[i-1]+a[i-2];
     
    	for(i=1;i<=n;i++)
    		printf(" %d",a[i]);
     
    	getch();
    }
  • 070. Write a program to accept a number n from user and then accept n array elements from user and print maximum and minimum array element from that set of array in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,i,a[20],max,min;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("Enter array elements...n");
    	for(i=0;i<n;i++)
    	{
    		printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
    	max=min=a[0];
    	for(i=0;i<n;i++)
    	{
    		if(a[i]>max)
    			max=a[i];
    if(a[i]<min)
    			min=a[i];
    	}
    	printf("nMin : %d",min);
    	printf("nMax : %d",max);
    	getch();
    }
  • 071. Write a program to accept a number n from user and then accept n array elements from user, print positive & Negative numbers separately in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,i,a[20];
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("Enter array elements...n");
    	for(i=0;i<n;i++)
    	{
    		printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
     
    	printf("nnNegative Elements : n");
    	for(i=0;i<n;i++)
    		if(a[i]<0)
    			printf("n%d",a[i]);
     
    	printf("nnPositive Elements : n");
    	for(i=0;i<n;i++)
    		if(a[i]>0)
    			printf("n%d",a[i]);
     
    	getch();
    }
  • 072. Write a program to accept a number n from user and then accept n array elements from user, print these array elements in ascending and descending order in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int n,i,a[20],j,max,min,temp;
    	clrscr();
    	printf("Enter number : ");
    	scanf("%d",&n);
    	printf("Enter array elements...n");
    	for(i=0;i<n;i++)
    	{
    	printf("Enter element %d : ",i+1);
    		scanf("%d",&a[i]);
    	}
    	max=a[0];
    	for(i=0;i<n;i++)
    	{
    		for(j=0;j<i;j++)
    			if(a[i]>a[j])
    			{
    				temp=a[i];
    				a[i]=a[j];
    				a[j]=temp;
    			}
    	}
    	printf("Ascending order.....n");
    	for(i=0;i<n;i++)
    	{
    		printf(" %d  ",a[i]);
    	}
     
    	min=a[0];
    	for(i=0;i<n;i++)
    	{
    		for(j=0;j<i;j++)
    			if(a[i]<a[j])
    			{
    				temp=a[i];
    				a[i]=a[j];
    				a[j]=temp;
    			}
    	}
    	printf("nDescending order....n");
    	for(i=0;i<n;i++)
    	{
    		printf(" %d  ",a[i]);
    	}
     
    	getch();
    }
  • 073. Write a program to accept a mXn matrix and reprint it in matrix form in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,n,a[5][5];
    	clrscr();
    	printf("Enter order of matrix :n");
            scanf("%d%d",&m,&n);
    	printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    	{
    		for(j=0;j<n;j++)
    			printf("%d ",a[i][j]);
    		printf("n");
    	}
    	getch();
    }
  • 074. Write a program to accept two M x N matrices and add them in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,n,a[5][5],b[5][5],c[5][5];
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d%d",&m,&n);
    	printf("Enter matrix elements of first matrix.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&a[i][j]);
     
    	printf("Enter matrix elements of second matrix.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&b[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			c[i][j]=a[i][j]+b[i][j];
     
    	printf("Resultant matrix .....n");
    	for(i=0;i<m;i++)
    	{
    		for(j=0;j<n;j++)
    			printf("%d ",c[i][j]);
    		printf("n");
    	}
    	getch();
    }
  • 075. Write a program to accept a M x N matrix and print addition of their array elements in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,n,a[5][5],sum=0;
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d%d",&m,&n);
    	printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			sum=sum+a[i][j];
     
    	printf("nSum of matrix elements.....%d",sum);
    	getch();
    }
  • 076. Write a program to accept a M x N matrix and print addition of diagonal elements of that matrix in C language
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,a[5][5],sum=0;
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d",&m);
    	printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			if(i==j)
    				sum=sum+a[i][j];
     
    	printf("nSum of diagonal elements.....%d",sum);
    	getch();
    }
  • 077. Write a program to accept a M x N matrix and print addition of upper triangular matrix elements in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,a[5][5],sum=0;
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d",&m);
    	printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			if(i<j)
    				sum=sum+a[i][j];
     
    	printf("nSum of upper triangular elements.....%d",sum);
    	getch();
    }
  • 078. Write a program to accept a M x N matrix and print addition of lower triangular matrix elements in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,a[5][5],sum=0;
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d",&m);
    	printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<m;j++)
    			if(i>j)
    				sum=sum+a[i][j];
     
    	printf("nSum of lower triangular elements.....%d",sum);
    	getch();
    }
  • 079. Write a program to accept two M X N matrices and print their multiplication in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,n,k,a[5][5],b[5][5],c[5][5];
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d%d",&m,&n);
    	printf("Enter matrix elements of first matrix.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&a[i][j]);
     
    	printf("Enter matrix elements of second matrix.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&b[i][j]);
     
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    		{
    			c[i][j]=0;
    			for(k=0;k<n;k++)
    				c[i][j]=c[i][j]+a[i][k]*b[k][j];
    		}
     
    	printf("Resultant matrix .....n");
    	for(i=0;i<m;i++)
    	{
    		for(j=0;j<n;j++)
    			printf("%d ",c[i][j]);
    		printf("n");
    	}
    	getch();
    }
  • 080. Write a program to accept a M x N matrix and print it’s transpose matrix in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,m,n,a[5][5];
    	clrscr();
    	printf("Enter order of matrix :n");
    	scanf("%d%d",&m,&n);
    printf("Enter matrix elements.....n");
    	for(i=0;i<m;i++)
    		for(j=0;j<n;j++)
    			scanf("%d",&a[i][j]);
     
    	for(i=0;i<m;i++)
    	{
    		for(j=0;j<n;j++)
    			printf("%d ",a[j][i]);
    		printf("n");
    	}
    	getch();
    }
  • 081. Print string in reverse,its length,in uppercase,lowercase and copy into another string
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    main()
    {
        char *s1,*s2;
        clrscr();
        printf("Enter string : ");
        scanf("%s",s1);
        printf("Reverse String : %s",strrev(s1));
        printf("Lenght: %d",strlen(s1));
        printf("String in UPPER CASE : %s",strupr(s1));
        printf("String in lower case : %s",strlwr(s1));
        strcpy(s2,s1);
        printf("nCopied string is...%s",s2);
        getch();
    }
  • 082. Write a program to accept a string and print no. of aphlabets, digits, special symbols present in it in C language
    #include<stdio.h>
    #include<conio.h>
    #include<ctype.h>
    main()
    {
    	char *s;
    	int i,alphabets=0,digits=0,symbols=0;
    	clrscr();
    	printf("Enter string : ");
    	scanf("%s",s);
    	for(i=0;s[i]!='';i++)
     
    		if(isalpha(s[i]))
    			alphabets++;
    		else if(isdigit(s[i]))
    			digits++;
    		else
    			symbols++;
     
    	printf("nAphabets : %d",alphabets);
    	printf("nDigits   : %d",digits);
    	printf("nSymbols  : %d",symbols);
    	getch();
    }
  • 083. Write a program to accept two strings and compare them in C language
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    main()
    {
    	char *s1,*s2;
    	clrscr();
    	printf("Enter string 1 : ");
    	scanf("%s",s1);
    	printf("Enter string 2 : ");
    	scanf("%s",s2);
     
    	if(strcmp(s1,s2)>0)
    		printf("nString 1 is greater..");
    	else if(strcmp(s1,s2)<0)
    		printf("nString 2 is greater..");
    	else
    		printf("nStrings are equal..");
     
    	getch();
    }
  • 084. Write a program to accept two strings and concatenate them in C language
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    main()
    {
    	char *s1,*s2;
    	clrscr();
    	printf("Enter string 1 : ");
    	scanf("%s",s1);
    	printf("Enter string 2 : ");
    	scanf("%s",s2);
    	printf("nConcatinated string is...%s",strcat(s1,s2));
    	getch();
    }
  • 085. Write a program to print length of a given string in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,len=0;
    	char *s;
    	clrscr();
    	printf("Enter the string....");
    	scanf("%s",s);
    	for(i=0;s[i]!='';i++)
    		len++;
    	printf("The lenth of the string is...%d",len);
    	getch();
    }
  • 086. Write a program to copy a string into another string in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i;
    	char *s1,*s2;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s1);
    	for(i=0;s1[i]!='';i++)
    	{
    		s2[i]=s1[i];
    	}
    	s2[i]='';
    	printf("The copied string is...%s",s2);
    	getch();
    }
  • 087. Write a program to convert given string to UPPER CASE in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i;
    	char *s1;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s1);
     
    	for(i=0;s1[i]!='';i++)
    	{
    		if((s1[i]>='a')&&(s1[i]<='z'))
    			s1[i]=s1[i]-32;
    	}
    	printf("Resultant string is...%s",s1);
    	getch();
    }
  • 088. Write a program to convert givern string to lower case in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i;
    	char *s1;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s1);
     
    	for(i=0;s1[i]!='';i++)
    	{
    		if((s1[i]>='A')&&(s1[i]<='Z'))
    			s1[i]=s1[i]+32;
    	}
     
    	printf("Resultant string is...%s",s1);
    	getch();
    }
  • 089. Write a program to concatinate two strings in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,len=0,j;
    	char *s1,*s2;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s1);
    	printf("Enter the string 2....");
    	scanf("%s",s2);
     
    	for(i=0;s1[i]!='';i++)
    	{
             len++;
    	}
    	j=0;
    	for(i=len;s2[j]!='';i++)
    	{
    		s1[i]=s2[j];
    		j++;
    	}
    	s1[i]='';
     
    	printf("Resultant string is...%s",s1);
    	getch();
    }
  • 090. Write a program to count no, of alphlabets, digits, special symbols in C language
     
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,alphabets=0,digits=0,symbols=0;
    	char *s;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s);
     
    	for(i=0;s[i]!='';i++)
    	{
    		 if(((s[i]>='A')&&(s[i]<='Z'))||((s[i]>='a')&&(s[i]<='z')))
    				alphabets++;
    		 else if((s[i]>='0')&&(s[i]<='9'))
    				digits++;
    		 else
    				symbols++;
    	}
    	printf("nAlphabets : %d",alphabets);
    	printf("nDigits    : %d",digits);
    	printf("nSymbols   : %d",symbols);
    	getch();
    }
  • 091. Write a program to compare two strings in C language
    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
    main()
    {
    	int i;
    	char *s1,*s2;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s1);
    	printf("Enter the string 2....");
    	scanf("%s",s2);
     
    	for(i=0;s1[i]!='';i++)
    	{
    		 if(s1[i]!=s2[i])
    			{
    				if(s1[i]>s2[i])
    					printf("nString 1 is greater...");
    				else
    					printf("nString 2 is greater...");
    				getch();
    				exit(0);
    			}
    	}
    	printf("String are equal....");
    	getch();
    }
  • 092. Write a program to count all vowels present in the string in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,vowel=0;
    	char *s;
    	clrscr();
    	printf("Enter the string 1....");
    	scanf("%s",s);
     
    	for(i=0;s[i]!='';i++)
    	{
    		if((s[i]=='A')||(s[i]=='E')||(s[i]=='O')||(s[i]=='U')||(s[i]=='I')||
    		  (s[i]=='a')||(s[i]=='e')||(s[i]=='o')||(s[i]=='u')||(s[i]=='i'))
    						vowel++;
    	}
    	printf("nVowels : %d",vowel);
    	getch();
    }
  • 093. Write a program to reverse the given string in C language
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	int i,j,len=0;
    	char *s1,*s2;
    	clrscr();
    	printf("Enter the string ....");
    	scanf("%s",s1);
    	for(i=0;s1[i]!='';i++)
    		len++;
    	j=0;
    	for(i=len-1;i>=0;i--)
    	{
    		s2[j]=s1[i];
    		j++;
    	}
    	s2[j]='';
    	printf("nReversed String : %s",s2);
    	getch();
    }
  • 094. Write a program to check if the given string is palindrome or not

    E.g. NITIN, LIRIL, MALAYALAM.

    #include<stdio.h>
    #include<conio.h>
    #include<process.h>
    main()
    {
    	int i,j,len=0;
    	char *s1,*s2;
    	clrscr();
    	printf("Enter the string ....");
    	scanf("%s",s1);
    	for(i=0;s1[i]!='';i++)
    		len++;
    	j=0;
    	for(i=len-1;i>=0;i--)
    	{
    		s2[j]=s1[i];
    		j++;
    	}
    	s2[j]='';
    	for(i=0;s1[i]!='';i++)
    		if(s1[i]!=s2[i])
    		{
    			printf("nNot a palindrome");
    			getch();
    			exit(0);
    	}
    	printf("Palindrome");
    	getch();
    }
  • 095. Define a structure Employee having elements emp_id, name,etc. Accept data and reprint it
    #include<stdio.h>
    #include<conio.h>
     
    struct Employee
    {
     char name[50];
     int emp_id;
     long phone_no;
    };
     
    main()
    {
    	struct Employee e;
    	clrscr();
    	printf("Enter name : ");
    	scanf("%s",&e.name);
    	printf("Enter emp_id: ");
    	scanf("%d",&e.emp_id);
    	printf("Enter Phone Number: ");
    	scanf("%ld",&e.phone_no);
     
    	printf("nnEnter name : %s",e.name);
    	printf("nnEnter Emp Id       : %d",e.emp_id);
    	printf("nnEnter Phone Number : %ld ",e.phone_no);
     
    	getch();
    }
  • 096. Define a structure Student having fields roll_no, name, marks, etc, for 5 students, accept data and reprint
     
    #include<stdio.h>
    #include<conio.h>
     
    struct Student
    {
     char name[50];
     int roll_no;
     int m1,m2,m3;
    };
     
    main()
    {   int i;
    	struct Student s[5];
    	clrscr();
    	for(i=0;i<5;i++)
    	{   printf("nEnter data for Student %d.....n",i+1);
    		printf("Enter name           : ");
    		scanf("%s",&s[i].name);
    		printf("Enter Roll No.       : ");
    		scanf("%d",&s[i].roll_no);
    		printf("Enter marks for sub1 : ");
    		scanf("%d",&s[i].m1);
    		printf("Enter marks for sub2 : ");
    		scanf("%d",&s[i].m2);
    		printf("Enter marks for sub3 : ");
    		scanf("%d",&s[i].m3);
    	}
     
    	for(i=0;i<5;i++)
    	{   printf("nStudent   %dn",i+1);
    		printf("Name    : %sn",s[i].name);
    		printf("Roll No.: %dn",s[i].roll_no);
    		printf("Sub1    : %dn",s[i].m1);
    		printf("Sub2    : %dn",s[i].m2);
    		printf("Sub3    : %dn",s[i].m3);
    	}
     
    	getch();
    }
  • 097. Define a structure Employee having elements emp_id, name, DOB, DOJ etc. Accept data and reprint it. (use structure within structure)
    #include<stdio.h>
    #include<conio.h>
     
    struct Date
    {
    	int mm,dd,yy;
    };
     
    struct Employee
    {
    char name[50];
     int emp_id;
     struct Date DOB,DOJ;
    };
     
    main()
    {   int i;
    	struct Employee e;
    	clrscr();
    		printf("nEnter name           : ");
    		scanf("%s",&e.name);
    		printf("nEnter emp_id.        : ");
    		scanf("%d",&e.emp_id);
    		printf("nEnter Date of Joiningn ");
    		printf("(dd-mm-yy) : ");
    		scanf("%d-%d-%d", &e.DOJ.dd,&e.DOJ.mm,&e.DOJ.yy);
    		printf("nEnter Date of birthn ");
    		printf("(dd-mm-yy) : ");
    		scanf("%d-%d-%d", &e.DOB.dd,&e.DOB.mm,&e.DOB.yy);
     
    		printf("nName           : %s",e.name);
    		printf("nEmployee ID    : %d",e.emp_id);
    		printf("nEnter DOJ      : %d-%d-%d", e.DOJ.dd,e.DOJ.mm,e.DOJ.yy);
    		printf("nEnter DOB      : %d-%d-%d", e.DOB.dd,e.DOB.mm,e.DOB.yy);
     
    	getch();
    }
  • 098. Write a program to read and write a file character by character.
    #include<stdio.h>
    int main()
    {
        FILE *fp;   /* file pointer*/
        char fName[20];
        char ch;
     
        printf("nEnter file name to create :");
        scanf("%s",fName);
     
        fp = fopen(fName,"w");
        if(fp==NULL)
        {
            printf("File not created !!");
            exit(0); 
        }
     
        printf("File created successfully.");
        /*writing into file*/
        printf("nEnter text to write (press < enter > to save & quit):n");
        while( (ch = getchar())!='n')
        {
            putc(ch, fp); /*write character into file*/
        }
     
    /*again open file to read data*/
        fp = fopen(fName,"r");
        if(fp==NULL)
        {
            printf("nCan't open the file!!!");
            exit(0);
        }
     
        printf("nContents of file is :n");
        /*read text until, end of file is not detected*/
        while( (ch=getc(fp))!=EOF )
        {
            printf("%c",ch); /*print character on screen*/
        }
     
        fclose(fp);
        return 0;
    }
  • 099. Write a program to read and write a file line by line.
    #include <stdio.h>
    int main()
    {
        FILE *fp;
        char str[100];
        fp = fopen("C:\myfile.txt", "w");
     
        if (fp == NULL)
        {
           puts("An error occurred while opening the specified file");
        }
     
         printf("Enter your string:");
     
         gets(str);
     
         fputs(str, fp);
     
         fclose(fp);
     
        fp = fopen("C:\myfile.txt", "r");
     
        if (fp == NULL)
        {
           puts("An error occurred while opening the specified file");
        }
     
        while(1)
        {
           if(fgets(str, 10, fp) ==NULL)
                break;
           else
                printf("%s", str);
        }
     
        fclose(fp);
        return 0;
    }
  • 100. Merge two files by store data into third one
    #include<stdio.h>
    #include<stdlib.h>
     
    int main()
    {
       FILE *fp1 = fopen("file1.txt", "r");
     
       FILE *fp2 = fopen("file2.txt", "r");
     
       FILE *fp3 = fopen("file3.txt", "w");
     
       char c;
       if (fp1 == NULL || fp2 == NULL || fp3 == NULL)
       {
             puts("Could not open files");
             exit(0);
       }
     
       while ((c = fgetc(fp1)) != EOF)
          fputc(c, fp3);
     
       while ((c = fgetc(fp2)) != EOF)
          fputc(c, fp3);
     
       fclose(fp1);
       fclose(fp2);
       fclose(fp3);
       return 0;
    }
  • 101. Write a program accept a file name from user and print content of that file
    #include<stdio.h>
    int main(int argc, char *argv[])
    {
        if ( argc != 2 ){
             printf( "usage: %s filename", argv[0] );
        }
        else 
        {
            FILE *file = fopen( argv[1], "r" );
     
            if(file == NULL)
                 printf("Could not open filen");
            else 
            {
                int x;
                while((x=fgetc(file)) != EOF)
                     printf( "%c", x );
                fclose( file );
            }
        }
    }

101. Write a program accept a file name from user and print content of that file

#include<stdio.h>
int main(int argc, char *argv[])
{
    if ( argc != 2 ){
         printf( "usage: %s filename", argv[0] );
    }
    else 
    {
        FILE *file = fopen( argv[1], "r" );
 
        if(file == NULL)
             printf("Could not open file\n");
        else 
        {
            int x;
            while((x=fgetc(file)) != EOF)
                 printf( "%c", x );
            fclose( file );
        }
    }
}

100. Merge two files by store data into third one

#include<stdio.h>
#include<stdlib.h>
 
int main()
{
   FILE *fp1 = fopen("file1.txt", "r");
 
   FILE *fp2 = fopen("file2.txt", "r");
 
   FILE *fp3 = fopen("file3.txt", "w");
 
   char c;
   if (fp1 == NULL || fp2 == NULL || fp3 == NULL)
   {
         puts("Could not open files");
         exit(0);
   }
 
   while ((c = fgetc(fp1)) != EOF)
      fputc(c, fp3);
 
   while ((c = fgetc(fp2)) != EOF)
      fputc(c, fp3);
 
   fclose(fp1);
   fclose(fp2);
   fclose(fp3);
   return 0;
}

099. Write a program to read and write a file line by line.

#include <stdio.h>
int main()
{
    FILE *fp;
    char str[100];
    fp = fopen("C:\\myfile.txt", "w");
 
    if (fp == NULL)
    {
       puts("An error occurred while opening the specified file");
    }
 
     printf("Enter your string:");
 
     gets(str);
 
     fputs(str, fp);
 
     fclose(fp);
 
    fp = fopen("C:\\myfile.txt", "r");
 
    if (fp == NULL)
    {
       puts("An error occurred while opening the specified file");
    }
 
    while(1)
    {
       if(fgets(str, 10, fp) ==NULL)
            break;
       else
            printf("%s", str);
    }
 
    fclose(fp);
    return 0;
}

098. Write a program to read and write a file character by character.

#include<stdio.h>
int main()
{
    FILE *fp;   /* file pointer*/
    char fName[20];
    char ch;
 
    printf("\nEnter file name to create :");
    scanf("%s",fName);
 
    fp = fopen(fName,"w");
    if(fp==NULL)
    {
        printf("File not created !!");
        exit(0); 
    }
 
    printf("File created successfully.");
    /*writing into file*/
    printf("\nEnter text to write (press < enter > to save & quit):\n");
    while( (ch = getchar())!='\n')
    {
        putc(ch, fp); /*write character into file*/
    }
 
/*again open file to read data*/
    fp = fopen(fName,"r");
    if(fp==NULL)
    {
        printf("\nCan't open the file!!!");
        exit(0);
    }
 
    printf("\nContents of file is :\n");
    /*read text until, end of file is not detected*/
    while( (ch=getc(fp))!=EOF )
    {
        printf("%c",ch); /*print character on screen*/
    }
 
    fclose(fp);
    return 0;
}

097. Define a structure Employee having elements emp_id, name, DOB, DOJ etc. Accept data and reprint it. (use structure within structure)

#include<stdio.h>
#include<conio.h>
 
struct Date
{
	int mm,dd,yy;
};
 
struct Employee
{
char name[50];
 int emp_id;
 struct Date DOB,DOJ;
};
 
main()
{   int i;
	struct Employee e;
	clrscr();
		printf("\nEnter name           : ");
		scanf("%s",&e.name);
		printf("\nEnter emp_id.        : ");
		scanf("%d",&e.emp_id);
		printf("\nEnter Date of Joining\n ");
		printf("(dd-mm-yy) : ");
		scanf("%d-%d-%d", &e.DOJ.dd,&e.DOJ.mm,&e.DOJ.yy);
		printf("\nEnter Date of birth\n ");
		printf("(dd-mm-yy) : ");
		scanf("%d-%d-%d", &e.DOB.dd,&e.DOB.mm,&e.DOB.yy);
 
		printf("\nName           : %s",e.name);
		printf("\nEmployee ID    : %d",e.emp_id);
		printf("\nEnter DOJ      : %d-%d-%d", e.DOJ.dd,e.DOJ.mm,e.DOJ.yy);
		printf("\nEnter DOB      : %d-%d-%d", e.DOB.dd,e.DOB.mm,e.DOB.yy);
 
	getch();
}

096. Define a structure Student having fields roll_no, name, marks, etc, for 5 students, accept data and reprint

 
#include<stdio.h>
#include<conio.h>
 
struct Student
{
 char name[50];
 int roll_no;
 int m1,m2,m3;
};
 
main()
{   int i;
	struct Student s[5];
	clrscr();
	for(i=0;i<5;i++)
	{   printf("\nEnter data for Student %d.....\n",i+1);
		printf("Enter name           : ");
		scanf("%s",&s[i].name);
		printf("Enter Roll No.       : ");
		scanf("%d",&s[i].roll_no);
		printf("Enter marks for sub1 : ");
		scanf("%d",&s[i].m1);
		printf("Enter marks for sub2 : ");
		scanf("%d",&s[i].m2);
		printf("Enter marks for sub3 : ");
		scanf("%d",&s[i].m3);
	}
 
	for(i=0;i<5;i++)
	{   printf("\nStudent   %d\n",i+1);
		printf("Name    : %s\n",s[i].name);
		printf("Roll No.: %d\n",s[i].roll_no);
		printf("Sub1    : %d\n",s[i].m1);
		printf("Sub2    : %d\n",s[i].m2);
		printf("Sub3    : %d\n",s[i].m3);
	}
 
	getch();
}

095. Define a structure Employee having elements emp_id, name,etc. Accept data and reprint it

#include<stdio.h>
#include<conio.h>
 
struct Employee
{
 char name[50];
 int emp_id;
 long phone_no;
};
 
main()
{
	struct Employee e;
	clrscr();
	printf("Enter name : ");
	scanf("%s",&e.name);
	printf("Enter emp_id: ");
	scanf("%d",&e.emp_id);
	printf("Enter Phone Number: ");
	scanf("%ld",&e.phone_no);
 
	printf("\n\nEnter name : %s",e.name);
	printf("\n\nEnter Emp Id       : %d",e.emp_id);
	printf("\n\nEnter Phone Number : %ld ",e.phone_no);
 
	getch();
}

094. Write a program to check if the given string is palindrome or not

E.g. NITIN, LIRIL, MALAYALAM.

#include<stdio.h>
#include<conio.h>
#include<process.h>
main()
{
	int i,j,len=0;
	char *s1,*s2;
	clrscr();
	printf("Enter the string ....");
	scanf("%s",s1);
	for(i=0;s1[i]!='\0';i++)
		len++;
	j=0;
	for(i=len-1;i>=0;i--)
	{
		s2[j]=s1[i];
		j++;
	}
	s2[j]='\0';
	for(i=0;s1[i]!='\0';i++)
		if(s1[i]!=s2[i])
		{
			printf("\nNot a palindrome");
			getch();
			exit(0);
	}
	printf("Palindrome");
	getch();
}