wap in c to accept a number display the total count of digit

Answer Posted / govind279

#include<stdio.h>
int main()
{
int n,m,sum=0;
scanf("%d",&n);
for(m=0;((m=n%10)!=0);n=(n/10))
sum+=m;
printf("count is %d\n",sum);
}

Is This Answer Correct ?    14 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does sizeof return c?

616


Explain what is the benefit of using const for declaring constants?

623


what do u mean by Direct access files? then can u explain about Direct Access Files?

1653


What is a function in c?

583


Explain the Difference between the New and Malloc keyword.

694






Which control loop is recommended if you have to execute set of statements for fixed number of times?

824


What does the message "automatic aggregate intialization is an ansi feature" mean?

704


What is ambagious result in C? explain with an example.

2061


Is main a keyword in c?

646


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

958


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

764


if p is a string contained in a string?

1417


What is the best way of making my program efficient?

575


Is malloc memset faster than calloc?

628


How do we make a global variable accessible across files? Explain the extern keyword?

1430