HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C Program to Print Multiplication Table of Any Number ?


Q:- Write a C Program to Print Multiplication Table of Any Number ?
       Input
         #include<stdio.h>
         #include<conio.h>
         main()
   {
int num,i=1,t=1;
clrscr();
printf(“Enter a Number to Print Table =”);
scanf(“%d”,&num);
while(i<=10)
{
t=num*i;
i++;
printf(“%d*%d=%d\n”,num,i,t);
}
getch();
   }


Output

Enter a Number to Print Table = 2
2     *     1     =     2
2     *     2     =     4
2     *     3     =     6
2     *     4     =     8
2     *     5     =     10
2     *     6     =     12
2     *     7     =     14
2     *     8     =     16
2     *     9     =     18
2     *     10   =     20

C Program to Find Sum of all Odd Numbers b/w 1 to n ?


Q:- Write a C Program to Find Sum of all Odd Numbers b/w 1 to n ?
      Input
        #include<stdio.h>
        #include<conio.h>
        main()
  {
int num,i=1,s=0;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
while(i<=num)
{
s=s+i;
i=i+2;
}
printf(“Sum of all Odd Numbers = %d”,s);
getch();
   }


Output

Enter a Limit of N = 8
Sum of all Even Numbers = 16

C Program to Find Sum of all Even Numbers b/w 1 to n ?


Q:- Write a C Program to Find Sum of all Even Numbers b/w 1 to n ?
       Input
         #include<stdio.h>
         #include<conio.h>
         main()
    {
int num,i=2,s=0;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
while(i<=num)
{
s=s+i;
i=i+2
}
printf(“Sum of all Even Numbers = %d”,s);
getch();
  }


Output

Enter a Limit of N = 5
Sum of all Even Numbers = 6

C program to Find Sum of all Numbers b/w 1 to n ?


Q:- Write a C program to Find Sum of all Numbers b/w 1 to n ?
      Input
        #include<stdio.h>
        #include<conio.h>
        main()
   {
int num,i=1,s=0;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
while(i<=num)
{
s=s+i;
i++;
}
printf(“Sum of all Natural Numbers = %d”,s);
getch();
     }


Output

Enter a Limit of N = 5
Sum of all Natural Numbers = 15

C program to Print all Odd Numbers b/w 1 to 10 ?


Q:- Write a C program to Print all Odd Numbers b/w 1 to 10 ?
      Input
        #include<stdio.h>
        #include<conio.h>
        main()
  {
int i=1;
clrscr();
printf(“Odd Numbers b/w 1 to 10 are =”);
while(i<=10)
{
printf(“%d\n”,i);
i=i+2;
}
getch();
  }


Output

Odd Numbers b/w 1 to 10 are = 1
3
5
7
9

C program to Print all Even Numbers b/w 0 to 10 ?


Q:- Write a C program to Print all Even Numbers b/w 0 to 10 ?
       Input
         #include<stdio.h>
         #include<conio.h>
         main()
   {
int i=0;
clrscr();
printf(“Even Numbers b/w 0 to 10 are =”);
while(i<=10)
{
printf(“%d\n”,i);
i=i+2;
}
getch();
   }


Output

Even Numbers b/w 0 to 10 are = 0
2
4
6
8
10

C Program to Print all Alphabets From a to z ?


Q:- Write a C Program to Print all Alphabets From a to z ?
      Input
       #include<stdio.h>
       #include<conio.h>
       main()
   {
char ch=’a’;
clrscr();
printf(“Alphabets From a to z are =”);
while(ch<=’z’)
{
printf(“%c\t”,ch);
ch++;
}
getch();
    }


Output

Alphabets From a to z are = a b c d e f g h I j k l m n o p q r s t u v w x y z

C program to Print All Natural Numbers in Reverse From n to 1 ?


Q:- Write a C program to Print All Natural Numbers in Reverse From n to 1 ?
       Input
         #include<stdio.h>
         #include<conio.h>
         main()
     {
int i=num,num;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
while(i>=1)
{
printf(“%d\n”,i);
i--;
}
getch();
   }


Output

Enter a Limit of N = 5
5
4
3
2
1

C Program to Print All Natural Numbers From 1 to n ?


Q:- Write a C Program to Print All Natural Numbers From 1 to n ?
      Input
        #include<stdio.h>
        #include<conio.h>
        main()
    {
int num,i=1;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
while(i<=num)
{
printf(“%d\n”,i);
i++;
}
getch();
    }


Output

Enter a Limit of N = 5
1
2
3
4
5