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

can any one provide me the notes of data structure for ignou cs-62 paper

2233


Can you please explain the difference between syntax vs logical error?

1242


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

5143


What are the types of variables in c?

1089


What is keyword in c?

1067


Write a function that will take in a phone number and output all possible alphabetical combinations

1106


What is the difference between array and linked list in c?

1210


Explain what are the advantages and disadvantages of a heap?

1129


Explain what is a const pointer?

1124


When the macros gets expanded?

1490


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16925


Can i use “int” data type to store the value 32768? Why?

1242


how should functions be apportioned among source files?

1169


What is the difference between array_name and &array_name?

1354


Describe the difference between = and == symbols in c programming?

1459