wap in c to accept a number display the total count of digit
Answer Posted / santhi perumal
#include<stdio.h>
#include<conio.h>
int main()
{
int number,m,sum =0,count =0;
printf("Enter the number \n");
scanf("%d",&number);
while(number != 0)
{
m = number % 10;
sum = sum + m;
count++;
number = number / 10;
}
printf("\nThe number of Digits in the Given Number is
%d\n",count);
printf("The Sum of Digits in the Given Number is %d\n",sum);
}
| Is This Answer Correct ? | 19 Yes | 5 No |
Post New Answer View All Answers
What are examples of structures?
How do you declare a variable that will hold string values?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
Explain how can I open a file so that other programs can update it at the same time?
Linked lists -- can you tell me how to check whether a linked list is circular?
What are reserved words?
Can you please explain the difference between syntax vs logical error?
How many levels of pointers can you have?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Explain what is the difference between #include and #include 'file' ?
How can you allocate arrays or structures bigger than 64K?
How can I call fortran?
What is non linear data structure in c?
Write the Program to reverse a string using pointers.
How can I automatically locate a programs configuration files in the same directory as the executable?