write a program to display reverse of a number using for
loop?

Answer Posted / narendra

It is simple.use this and it works

#include <stdio.h>
#include <conio.h>

int main()
{
int rem,num;
clrscr();
printf("Enter the number\n");
scanf("%d",&num);
for (num= num; num > 0; num = num/10)
{

rem = num % 10;
printf("%d",rem);

}
return 0;
}

Is This Answer Correct ?    14 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please compare array with pointer?

625


I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...

9665


What are the advantages and disadvantages of a heap?

718


State the difference between x3 and x[3].

663


What is an arrays?

666






Do you know the use of fflush() function?

608


What happens if you free a pointer twice?

621


Is it possible to execute code even after the program exits the main() function?

832


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1504


Explain the term printf() and scanf() used in c language?

606


How can I handle floating-point exceptions gracefully?

643


What is the general form of function in c?

622


What is meant by operator precedence?

691


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

1967


Write a program to check palindrome number in c programming?

606