if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')

Answer Posted / aha na

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,sum=0;
clrscr();
printf("\n enter a number",i);
scanf("%d",&i);

while(i<=0)
{
j=i%10;
sum=sum+j;
i=i/10;
}
printf("\n the sum of the digits
are:%d\n");
getch();
}

Is This Answer Correct ?    14 Yes 30 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are identifiers in c?

626


1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3973


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1507


Why c is called free form language?

563


Can you please explain the difference between syntax vs logical error?

686






Why main is used in c?

581


differentiate built-in functions and user – defined functions.

613


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

1834


Is c language still used?

531


Explain what is the purpose of "extern" keyword in a function declaration?

613


What is spark map function?

578


please explain every phase in the "SDLC" in the dotnet.

2173


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

635


Explain what is wrong with this program statement? Void = 10;

761


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1896