Code for reversing of a number(Using while loop) Get link Facebook X Pinterest Email Other Apps Code for reversing of a number(Using while loop) #include<stdio.h> #include<conio.h> void main() { int r=0,c,n; printf("Enter any number"); scanf("%d",&n); while(n>0) { c=n%10; n=n/10; r=r*10+c; } printf("Reverse=%d",r); getch(); } Output Get link Facebook X Pinterest Email Other Apps Comments
Code for pattern 1 Code for Pattern 1 *** *** *** #include<stdio.h> #include<conio.h> void main() { int i,j; for(i=1;i<=3;i++) { for(j=1;j<=3;j++) { printf("*"); } printf("\n"); } getch(); } Output Read more
Code to find factorial(Using for loop) Code to find factorial(Using for loop) #include<stdio.h> #include<conio.h> void main() { int f=1,i,n; printf("Enter any number"); scanf("%d",&n); for(i=n;i>=1;i--) { f=f*i; } printf("Factorial=%d",f); getch(); } Output Read more
Code to print even numbers between 1..........100(using for loop) Code to print even numbers between 1..........100(using for loop) #include<stdio.h> #include<conio.h> void main() { int i; for(i=1;i<=100;i++) { if(i%2==0) { printf("%d",i); } } getch(); } Output Read more
Comments
Post a Comment