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

Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

659


Differentiate between static and dynamic modeling.

607


how do you execute a c program in unix.

630


Do you know pointer in c?

575


What is the difference between text and binary i/o?

586






Why doesnt long int work?

602


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

858


write a program to display all prime numbers

1448


Explain what is #line used for?

599


Write a program to identify if a given binary tree is balanced or not.

673


What are the 5 data types?

590


What is the g value paradox?

633


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

652


write a program to create a sparse matrix using dynamic memory allocation.

4363


What are high level languages like C and FORTRAN also known as?

669