Program for Reversing Digits of a given number

# include <stdio.h>
#include<conio.h>
main ( )
{
int r,s =0,n;
printf ( “enter a number”);
scanf (“%d”, &n);
while ( n ! = 0)
{
r = n % 10;
s=r + s * 10;
n = n\10;
}
printf (“reverse of a number is %d”, s);
getch ( );
}

Out Put:

enter a number 89
Reverse of a number is 98



Related

Program for string copy using string handling functions

#include<stdio.h> #include<conio.h> #include<string.h> void main() { char s [10], c[10]; printf (“enter string”); gets (s); strcpy (c,s); puts (c); getch(); } ...

Write A Program for sorting of n strings

#include<stdio.h> #include<conio.h> # include<string.h> void main ( ) { char str [20] [15],s[15]; int i,j,n; printf (“enter how many strings”);    &nbs...

Write A Program to check whether the given string is palindrome or not

#include<stdio.h> #include<conio.h> # include<string.h> void main() { char str [20]; int i,j, n, flag = 0; printf (“enter a string”); gets (str); n = strlen ( str); j&n...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item