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 digits in C?

Answer Posted / vani

//sum of digits in c//
#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0;
clrscr();
printf("\n enter the number:");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
sum=sum+r;
n=n/10;
}
printf("sum=%d");
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why pointers are used?

1026


Is c procedural or object oriented?

956


What should malloc(0) do?

1060


What are bitwise shift operators in c programming?

1040


Is there any demerits of using pointer?

1018


What is the difference between ++a and a++?

1155


Why is c still so popular?

1007


i want to know the procedure of qualcomm for getting a job through offcampus

2409


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

1183


Can we increase size of array in c?

923


What is a structure in c language. how to initialise a structure in c?

1022


What is c++ used for today?

1062


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1630


What are the basic data types associated with c?

1222


Why static is used in c?

1035