### Binary to Decimal in C program

//Binary to Decimal in C program #include <stdio.h> main() {     int  num, binary_val, decimal_val = 0, base = 1, rem;     printf("Enter a binary number(1s and 0s) \n");     scanf("%d", &num); /* maximum five digits */     binary_val = …

### Prime or Not Using for statement in C program

//for statement #include<stdio.h> #include<conio.h> int main() { int n,i,flag=0; printf("ENter a positive integer:"); scanf("%d",&n); for(i=2;i<n/2;i++) { if(n%i==0) { flag=1; break; } } if(flag==0) printf("%d is a prime number",n); else printf("%d is not prime number",n); return 0; } PRIME OR NOT …

### HCF and LCM using while statement in C Program

//using while statement #include<stdio.h> int main() { int a,b,x,y,t,gcd,lcm; printf("Enter two integer:\n"); scanf("%d%d",&x,&y); a=x; b=y; while(b!=0) { t=b; b=a%b; a=t; } gcd=a; lcm=(x*y)/gcd; printf("Greatest common divisor of %d amd %d=%d\n",x,y,gcd); printf("Least common multiple of %d and %d=%d\n",x,y,lcm); return 0; }

### Print numbers entered and find sum using do while statement in C program

//print number entered and find sum using do while #include<stdio.h> #include<conio.h> int main() { int n,i=1,sum=0; printf("Enter the value of N:"); scanf("%d",&n); printf("First %d numbers are\n",n); do { printf("%7d",i); sum=sum+i; i++; } while(i<=n); printf("\n\nSum=%d\n",sum); return 0; }

### Decimal to Binary using while statement in C program

//using while statement #include<stdio.h> #include<conio.h> main() { int n,m,r,p=1,t=0; printf("Enter any decimal number:"); scanf("%d",&n); m=n; while(n!=0) { r=n%2; t=t+(r*p); n=n/2; p=(p*10); } printf("Decimal Number %d=Binary Number:%d",m,t); } DECIMAL To BINARY USING RECURSION // C Program to Convert a Number Decimal …

### multiplication table in C program

//multiplication table #include<stdio.h> #include<conio.h> main() { int i,j,p; printf("The Multiplication table of 1 to 10 is:"); for (i=1;i<=10;i++) { for(j=1;j<10;j++) { p=i*j; printf("%d*%d=%d\n",i,j,p); } printf("\n"); } getch(); }

### input integer in array and find total in C program

//input 10 integer and find total #include<stdio.h> #include<conio.h> main() { int num,i,total=0; for(i=0;i<10;i++) { printf(“input interger number:”); scanf(“%d”,&num[i]); } for(i=0;i<10;i++) { total=total+num[i]; } printf(“Total of 10 integer numbers=%d”,total); }

### transpose of matrix in C Program

//transpose of matrix //transpose of matrix #include<stdio.h> #include<conio.h> #define ROWS 3 #define COLS 3 int main(void) { int a[ROWS][COLS]={{1,2,3},{4,5,6},{7,8,9}}; int i,j,tmp; for(i=1;i<ROWS;i++) { for (j=0;j<COLS;j++) { tmp=a[i][j]; a[i][j]=a[j][i]; a[j][i]=tmp; } } printf("TRANSPOSE of Matrix\n"); for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) printf("%d",a[i][j]); printf("\n"); } …