See what questions your friends are asking today.

If a five digit number is input through the keyboard write a program to calculate the sum of its digits?

Answer:
If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example if the number that is input is 12391 then the output should be displayed as 23402.
//Author::Mudasir Yaqoob.....

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

int main()
{

long number,t;
int i=0;
long temp[5];
printf("Enter the five digit number:\n\n");
scanf("%ld",&number);
while(i<=4)
{

t=number%10+1;
temp[i]=t;
number=number/10;
i++;

}
printf("Reverse number\n\n\n\n");
for(i=4;i>=0;i--)
{
printf("%ld",temp[i]);
}
getch();
}

Contributors

«
Hootershooter74
Trust: 271
  • Computers Supervisor
»

Top Contributors This Week

  • Trust Points: 2708
  • Member Since: 3/09
  • Trust Points: 4855
  • Member Since: 1/12
  • Trust Points: 2582
  • Member Since: 12/10
  • Trust Points: 10073
  • Member Since: 11/09
  • Trust Points: 3790
  • Member Since: 10/10