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...

how to find sum of 5 digits in C?

Answer Posted / guest

#include<stdio.h>
int main()
{
int n,sum=0;
printf("enter number");
scanf("%d".&n);
for(int i=0;i<5;i++)
{
sum=sum+(n%10);
n=n/10;
}
printf("sum is %d",sum);
return 0;
}

Is This Answer Correct ?    16 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is malloc memset faster than calloc?

1071


What is action and transformation in spark?

1161


What are dangling pointers? How are dangling pointers different from memory leaks?

1310


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1903


What does c in a circle mean?

1076


What is file in c preprocessor?

1145


What is meant by initialization and how we initialize a variable?

1048


What are the features of c language?

1069


How can I get random integers in a certain range?

1065


Create a simple code fragment that will swap the values of two variables num1 and num2.

1285


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

1055


What is the difference between struct and union in C?

1310


What is %d called in c?

1230


What is the use of #define preprocessor in c?

1077


How many levels deep can include files be nested?

1140