Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 type modifiers in c?

1001


Write a program in c to replace any vowel in a string with z?

1078


I came across some code that puts a (void) cast before each call to printf. Why?

1156


how to introdu5ce my self in serco

1938


What is difference between %d and %i in c?

1183


Why can’t we compare structures?

1229


What is a buffer in c?

948


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1648


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2692


What is the use of getchar functions?

1130


How can you access memory located at a certain address?

1064


What is a struct c#?

1001


How pointer is different from array?

1020


Explain how does free() know explain how much memory to release?

1016


Differentiate between #include<...> and #include '...'

1007