Friday, 10 January 2014

C Program to Add reversed number with Original Number

C program to add reversed number with Original Number ?


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>

void main()
{
int num1, num2;
char str[10];
clrscr();

printf("nEnte the Number : ");
scanf("%d",&num1);

sprintf(str,"%d",num1);

strrev(str);

num2 = atoi(str);

printf("nReversed Number + Original Number = %d ",num1 + num2 );
getch();
}
Output:
Ente the Number : 123Reversed Number + Original Number = 444

No comments:

Post a Comment