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

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

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();
}
2 people found this useful

Write a program that would input a 4 digit number and computes the sum of the digit?

\nIn Visual Basic....\n. \nDeclare a variable called "InputNumb"\n. \n-->> Do some checking using the len function to ensure that it has four digits\n. \nDeclare a variable

How do you write a program in assembly language to calculate the sum of two single digit numbers?

;this program adds 2 1-digit numbers ;without carry ,sum < 10 or with carry , sum >9 ;coded by -----LenmorVash------ ;coded in emu8086 org 100h mov dx,offset str mov ah

Write a c program to compute the sum of digits of a given five integer number?

include #include using std::cin; using std::cout; using std::endl; using std::string int main() { const int numberOfdigits = 6; string myNumber = "0"; char myNumberChar[n

Five digit number input the keyboard program reverse the number?

include #include using std::cin; using std::cout; using std::endl; using std::string; int main() { const int numberOfDig = 5; string num = "0"; cout num; string revNum =

Write program for sum of first and last digit of a number?

// this v'll work to obtain sum of 1st and last number of any number #include int main() { int num,sum=0,i,fd,ld; printf("enter the number); . scanf("%d",&num)

Write a program to print sum of the digits in the given number?

The following function will sum the digits in any positive number. unsigned int sum_digits(unsigned int num, unsigned int base=10) { sum=0; if(base>1) // base must be 2 or

A 5 digit positive integer is entered through the keyboard how to write a function in C to calculate sum of digits of the 5 digits number by using recursion and without using recursion?

include int digit_sum(int); int digit_sum_rec(int); main() { int num; printf("Enter 5 digit positive integer. : "); scanf("%d",&num); printf("The sum of the

Using if condition and while loop in C get a number of input from the keyboard and calculate the sum of odd and even digits separately?

include #include void main() { int num,num_save; int ar[5],i=0,res_e=0,res_o=0; printf("\nEnter the number : "); scanf("%d",&num); num_save=num; while(num_s

Write a c program to find the sum of the five digits of a number?

To determine the value of the least-significant digit in a number,you divide by the base and take the remainder. To get the nextdigit, divide by the base and repeat. The follo