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 / jegadeesh

#include<stdio.h>
void main()
{
int i,j;
scanf("%d",&i);
if((i%9)==0)
printf("The sum of digit is 9");
else
{
j=i%9;
printf("%d",j);
}
}

//the above will print result as 6 if given as 12345 since
1+2+3+4+5=15 and proceeding 1+5 we get as 6.....
is this an apt answer...

Is This Answer Correct ?    11 Yes 36 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is indirection? How many levels of pointers can you have?

1089


Explain built-in function?

1086


What are register variables? What are the advantage of using register variables?

1124


Where in memory are my variables stored?

1111


How can I find the modification date and time of a file?

1024


I need a sort of an approximate strcmp routine?

984


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1796


Explain how do you list a file’s date and time?

986


What are high level languages like C and FORTRAN also known as?

1105


What is the basic structure of c?

1008


Why c is faster than c++?

974


What is else if ladder?

961


Explain about block scope in c?

1030


What is assert and when would I use it?

962


Why do we use header files in c?

1015