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

Write a program to reverse a given number in c language?

623


How can I write a function analogous to scanf?

662


how to capitalise first letter of each word in a given string?

1436


What does 1f stand for?

618


How can I do peek and poke in c?

623






a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

631


#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

633


Why we use conio h in c?

591


What are the 32 keywords in c?

639


Explain how do you list a file’s date and time?

621


What are valid signatures for the Main function?

704


What is null character in c?

695


Can you please compare array with pointer?

621


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

727


What is return type in c?

646