View Single Post
Old 11-30-2004, 06:09 AM   #6 (permalink)
intercodes
 
Ultra Techie

Join Date: Jun 2004

Posts: 973

intercodes

Send a message via Yahoo to intercodes
Default

cloud,


Note: I didnt compile the program,there maybe errors with the variables


#include <stdio.h>
int main(void)
{
long int number,square,reverse=0,temp,rev1=0;
printf ("Enter the number: ");
scanf("%li",&number);
if( number >=0 && number <=999)
{
square = number*number;
while(number>0)
{
temp=number%10;
rev1=reverse*10;
reverse=rev1 + temp;
number/=10;
}
printf("\n The input number is : %li" ,number);
printf("\n The square of the number is : %li",square);
printf("\n The reverse of the number is : %li",reverse);
}
return 0;
}
intercodes is offline