C Program to Print Multiplication Table of Given Number

Here you will get C program to print multiplication table of given number. Below program will ask user to enter a number then display its table. #include<stdio.h> int main() { int i,n; printf(“Enter any number:”); scanf(“%d”,&n); printf(“Table of %d is:\n”, n); for(i=1;i<=10;++i) printf(“\n%d*%d=%d”,n,i,n*i); return 0; }   Output Enter any number:6 Table of 6 is: …

C Program to Print Multiplication Table of Given Number Read More »

C program to generate divisors of an integer

#include<stdio.h> #include<conio.h> void main() { int i,n; clrscr();  //to clear the screen printf(“Enter any number:”); scanf(“%d”,&n); printf(“nDivisors of %d are”,n); for(i=1;i<n/2;++i) if(n%i==0) printf(” %d”,i); getch();  //to stop the screen }

Program for Number Palindrome in C

Here you will get program for number palindrome in C. A number is palindrome if it is equal to its reverse. For example 121, 111, 1331 are palindrome numbers. Program for Number Palindrome in C #include<stdio.h> int main() { int n,a,b=0,num; printf(“Enter any number:”); scanf(“%d”,&n); num=n; while(n!=0) { a=n%10; b=a+(b*10); n=n/10; } if(num==b) printf(“\nThe given …

Program for Number Palindrome in C Read More »

Program for Prime Number in C

Here you will get program for prime number in C. A number that is only divisible by 1 or itself is called prime number. For example, 17 is prime, 6 is not prime, etc. Program for Prime Number in C #include<stdio.h> int main() { int n,i,flag=1; printf(“Enter any number:”); scanf(“%d”,&n); for(i=2;i<n/2;++i) if(n%i==0) { flag=0; break; …

Program for Prime Number in C Read More »

Program for Factorial in C

Here you will get program for factorial in C. We can find factorial of any number by multiplying it with all the numbers below it. For example, factorial of 3 will be 6 (3 * 2 * 1). Program for Factorial in C #include<stdio.h> int main() { long i,n,fac=1; printf(“Enter value of n:”); scanf(“%ld”,&n); for(i=n;i>=1;–i) fac*=i; …

Program for Factorial in C Read More »

C program to input number of week's day(1-7) and translate to its equivalent name of the day of the week

#include<stdio.h>#include<conio.h> void main(){ int ch; clrscr(); //to clear the screen printf(“Enter number of week’s day(1-7):”); scanf(“%d”,&ch); switch(ch) { case 1: printf(“nSunday”); break; case 2: printf(“nMonday”); break; case 3: printf(“nTuesday”); break; case 4: printf(“nWednesday”); break; case 5: printf(“nThursday”); break; case 6: printf(“nFriday”); break; case 7: printf(“nSaturday”); break; } getch(); //to stop the screen}