Write a program which counts for the number of digits in an integer number being
entered by user using:
a. For loop
b. While loop
c. Do while loop
1
Expert's answer
2021-05-14T23:07:18-0400
#include<stdio.h>intmain(){
printf("Enter a number : ");
int n;
int count=0;
scanf("%d",&n);
while(n>0)
{
n=n/10;
count++;
}
printf("\nThe number of digits in entered number is : %d",count);
return0;
}
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments