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 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();
}
+ 5 others found this useful
Thanks for the feedback!
Follow

Time to spill! Who's your celebrity crush?

View Full Interview

What would you like to do?

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 (MORE)

What would you like to do?

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 (MORE)

What would you like to do?

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 (MORE)

Digitize Your Paper Genealogy Documents

A good way to reduce the amount of paperwork involved in genealogical research is to begin a program of digitizing or scanning documents then attaching the digitized copies to (MORE)

5 Large Online Digital Newspaper Archives

Countries around the world recognize that their historical legacy of newspapers is deteriorating. As a result, there are huge efforts to digitize all of the newspapers on both (MORE)

Strategies to Boost Digital Reading Comprehension

As technology advances, it is creeping into every aspect of our daily lives. Our workplaces, homes, and even our schools are becoming interconnected technological hubs. Yet, f (MORE)

What would you like to do?

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 (MORE)

What would you like to do?

Write a java program to find out the sum of a number of n digits?

class Sum_Of_Digits { public static void printSumandnoofdigits(int n) { int temp = n; int count = 0; int sum = 0; while ( n > 0 ) { sum = sum + n % 10; n = (MORE)

What would you like to do?

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 (MORE)