# 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();
}
+ 5 others found this useful

# 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 last… (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 the Numbe… (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<3;n… (MORE)

# Setting Number Formats in Excel

A spreadsheet in Excel is comprised of a grid of cells. Each cell (which is defined as the intersection between a row and a column) can be allocated its own attributes. This i… (MORE)

# Counting: Activities and Number Crafts for Preschoolers

Your preschool-aged child is at a point in his or her young life when learning is incredibly fun and entertaining. Even though attention spans are very short, their ability to… (MORE)

In Bible

# Introduction to the Book of Numbers

The book of Numbers is the fourth book in the Bible. It chronicles the history of the Hebrew people, following the giving of the Ten Commandments to Moses at Mount Sinai. It i… (MORE)

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

include<stdio.h>   #include<conio.h>   void main()   {   long int n,r,m,max=0,count=0;   clrscr();   printf("Enter the Number:");   scanf("%ld… (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; // retrives th… (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("%c",&… (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(); } unsigned… (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); printf("The s… (MORE)

In Bible

# The Book of Numbers

The Bible tells us that the Exodus of Israelites out of Egypt was one of the greatest epic adventures in history. Against impossible odds, but with the help of God, Hebrew peo… (MORE)

In Puzzles