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

Answer Posted / jayesh jain

#include<stdio.h>
#include<conio.h>
void main()
{
int num,i;
int rem;
clrscr();
printf("\n enter number");
scanf("%ld",&num);
printf("\n the reverse of number %ld is ",num);
for(i=0;num>0;i++)
{
rem=num%10;
num=num/10;
printf("%d",rem);
}
getch();
}

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me is null always defined as 0(zero)?

683


What is a method in c?

633


What is mean by data types in c?

561


How can I read data from data files with particular formats?

616


p*=(++q)++*--p when p=q=1 while(q<=6)

1274






If the size of int data type is two bytes, what is the range of signed int data type?

603


What does nil mean in c?

685


Where register variables are stored in c?

560


What is scope of variable in c?

577


Explain b+ tree?

639


Why pointers are used?

639


Explain void pointer?

598


Explain what is the difference between the expression '++a' and 'a++'?

635


What is the difference between array and pointer in c?

594


Explain the use of keyword 'register' with respect to variables.

600