Saved Bookmarks
| 1. |
Write a C program using while loop to reverse the digits of a given number. (for example, If number is=12345 then output number is= 54321) |
|
Answer» A C program to reverse the digits of a given number: #include<studio.h> #include<conio.h> void main() { int n,r; clrscr(); printf("enter an integer"); scanf("%d",&n); printf("\nreverse of %d : ",n); while(n>0) { r=n%10; printf("%d",r); n=n/10; } getch(); } |
|