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 / revanth kumar.p

include<stdio.h>
#include<conio.h>
int main()
{
int num,len = 1,a,b;
printf("Enter a number");
scanf("%d",&num);
while(num >= 10)
{
num = num/10;
len++;
}
printf("%d",len);
a=len;
a=len*(len+1)%2;
printf("\n%d",a);
b=len;
b=len*(len+1)/2;
printf("\n%d",b);
a=a+b;
printf("\n%d",a);


getch();

}

Is This Answer Correct ?    4 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the meaning of 2d in c?

1122


what is the significance of static storage class specifier?

2252


What is the hardest programming language?

1143


What is const volatile variable in c?

1031


How can I invoke another program or command and trap its output?

1094


Which is the best website to learn c programming?

1075


What is pass by reference in functions?

842


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

1050


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1977


What is static volatile in c?

1019


What are the 4 data types?

1012


What is optimization in c?

998


How many bytes are occupied by near, far and huge pointers (dos)?

1153


What is a floating point in c?

1070


What are the three constants used in c?

993