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 6 Code for pattern 6 1 23 456 78910 #include<stdio.h> #include<conio.h> void main() { int i,j,l=1; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) { printf("%d",l); l++; } printf("\n"); } getch(); } Output Read more
Code to check leap year Code to check leap year #include<stdio.h> #include<conio.h> void main() { int a; printf("Enter year"); scanf("%d",&a); if(a%4==0) { printf("It is a leap year"); } else { printf("It is not a leap year"); } getch(); } OUTPUT Read more
Comments
Post a Comment