What would you like to do?

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 calculate the sum of its digits?
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();
}
+ 6 others found this useful
Thanks for the feedback!
If a 4 digit number is input through the keyboard write a C program to obtain the sum of first and last digit of this number?

If a 4 digit number is input through the keyboard write a C program to obtain the sum of first and last digit of this number?

include #include void main(void) { int num, a, b, sum; printf(""Please enter a four digit number: ""); scanf("%d", &num); a=num/1000; // retrives the first digit(left most dig

What to do to write a c program to input a number then a digit and findout the place value of that digit?

include int main() { int d,j=1,i,flag=0,count=0,k=0; int b[]; char a[],c; printf("enter the number="); scanf("%s",a); printf("enter the digit="); scanf("%c",&c); prin

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 d

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); ld=n

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

int sumDigits(int n) {   int sum = 0;    while( n > 0 ) {   sum += (n % 10); // add last digit of n to sum   n /= 10; // divide n by 10 to "chop off" the la
Write a program to compute sum of digits of a given number in Java?

Write a program to compute sum of digits of a given number in Java?

public static final int getSumDigits(int n) {   int sum = 0; while( n != 0 ) { // Add right most digit to sum sum += n % 10; // Chop off right most digit from n n
Write a program that would find the count of occurrence of largest digit in the input number?

Write a program that would find the count of occurrence of largest digit in the input number?

include   #include   void main()   {   long int n,r,m,max=0,count=0;   clrscr();   printf("Enter the Number:");   scanf("%ld",&n);   m=n;  
A five digit no is entered through the keyboard write a program to obtain the reversed no and to determine whether the original no and reversed no is equal or not?

A five digit no is entered through the keyboard write a program to obtain the reversed no and to determine whether the original no and reversed no is equal or not?

1) first you have to find the reverse of an integer.. code is given below, #include void main() { int a,b,m,s=0; printf("enter the value of a"); scanf("%d",&a); b=a;
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?

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