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
please give me some tips for the placement in the TCS.
what is ur strangth & weekness
What is return type in c?
Explain how can I pad a string to a known length?
Why is c platform dependent?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is the purpose of type declarations?
Explain how can a program be made to print the name of a source file where an error occurs?
what do u mean by Direct access files? then can u explain about Direct Access Files?
can any one tel me wt is the question pattern for NIC exam
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
If fflush wont work, what can I use to flush input?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
How can I open a file so that other programs can update it at the same time?
What are the advantages of Macro over function?