C Program to Count the digits in the given number.

Sample Input 1 :

734

Sample Output 1 :

3

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#include<stdio.h> int main() { //write your code here }

Program or Solution

				
			
					
#include<stdio.h>
int main()
{
	int n,num,count;
	scanf("%d",&num);
	n=num;
	while(num!=0)
	{
		num/=10;
		count++;
	}
	printf("%d digits in %d",count,n);
	return 0;
}
		
			
				
			

Program Explanation

refer video tutorial

Comments