The need:
This program was asked me by a reader of this blog.
The code:
-------------------------------------------------------
-------------------------------------------------------
This program was asked me by a reader of this blog.
The code:
-------------------------------------------------------
#include<stdio.h> main() { int number1,i,number2=0; printf("enter a natural number.\n"); scanf("%d",&number1); if(number1<1) { printf("the number entered was not a natural number.\n"); exit(0); } i=number1; while(i>0) { number2=10*number2+i%10; i=i/10; } printf("the reverse of %d number is %d\n",number1,number2); }
-------------------------------------------------------
thanks mate :)
ReplyDelete