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

# Speaking of the Playboy Mansion, what is a typical day at the mansion like?

View Full Interview

# How do you calculate the sum of all three-digit positive numbers?

The highest 3-digit number is 999. It's the 999th counting number.    The first 99 counting numbers have fewer than 3 digits.    So there are (999 - 99) = 900 po (MORE)

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

include<stdio.h> 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( (MORE)

# 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<stdio.h> #include<conio.h> void main(void) { int num, a, b, sum; printf(""Please enter a four digit number: ""); scanf("%d", &num); a=num/1000; // retr (MORE)
In Italy

# 5 Types of Italian Keyboards Online

There are many reasons to take a Eurotravel trip to a place like Italy. The culture, food, wine, and breathtaking sights are at the top of the list. However, sometimes you mig (MORE)

# Easy to Use Digital Drawing Programs

Digital drawing software provides you with all the tools you need to draw, paint or create graphics. Here are some of the best digital drawing programs available.SketchBook Pr (MORE)

# A Beginner's Guide to Digital Scrapbooking

If you've been curious about digital scrapbooking, here's an overview of what it is and how to get started. (MORE)
In Records

# 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)

# What Was the First Digital Computer?

A timeline showing a history of computers, or digital computers, can make a fascinating study. Compared to today's computers, the early machines were behemoths. Slow by today' (MORE)

# 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 <stdio.h> int digit_sum(int); int digit_sum_rec(int); main() { int num; printf("Enter 5 digit positive integer. : "); scanf("%d",&num); print (MORE)

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

# Write a program in c language to reverse the five digits number?

//Reverse of the Number // Programme Written By Maulin Thaker Ahmedabad; #include<stdio.h> #include<conio.h> void main() { int a,b,c,d,e; clrscr(); printf("Enter (MORE)

# Write a C program for sum of two digit numbers by using loop?

include<stdio.h>   void main()   {   int no,rem=0,sum=0,n; /*declaration*/   printf("Enter 2 digit number:");   scanf("%d",&no);   for(n=1;n& (MORE)

# If a five digit number is input through the keyboard write a program to reverse a number?

include <stdio.h> #include <conio.h> { unsigned long reverse(int); int n; clrscr(); Printf("reverse of a given no is:%lu",reverse(n)); getch(); } (MORE)