HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT
IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE
Answer Posted / prof.gagandeep jagdev
#include<stdio.h>
#include<conio.h>
long int num,result=0,i;
void main()
{
clrscr();
printf("\nenter the number to be reversed=");
scanf("%ld",&num);
while(num>0)
{
i=num%10;
num=num/10;
result=result*10+i;
}
printf("\nReversed number is=%ld",result);
getch();
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is the difference between Printf(..) and sprint(...) ?
how to write a c program to print list of fruits in alpabetical order?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
What is table lookup in c?
What are the features of c language?
How we can insert comments in a c program?
What is meant by recursion?
Explain what is the difference between a string and an array?
What is meant by gets in c?
Add Two Numbers Without Using the Addition Operator
What is linear search?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
What is the purpose of macro in C language?
write a program fibonacci series and palindrome program in c
how to execute a program using if else condition and the output should enter number and the number is odd only...