simple c program for 12345 convert 54321 with out using string

Answer Posted / sreenivas

#include<stdio.h>
main()
{
long n=12345,r=0;
while(n)
{
r=r*10+n%10;
n=n/10;
}
printf("%ld",r);
}

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you search data in a data file using random access method?

691


Write a program for finding factorial of a number.

629


What is wrong with this program statement? void = 10;

816


Can an array be an Ivalue?

657


What is return in c programming?

507






Is there a built-in function in C that can be used for sorting data?

742


What is || operator and how does it function in a program?

622


What are the different properties of variable number of arguments?

659


What is enumerated data type in c?

617


What is an lvalue?

630


When should the volatile modifier be used?

678


How #define works?

611


Is array name a pointer?

601


write a proram to reverse the string using switch case?

2461


What is hungarian notation? Is it worthwhile?

692