Problem Description
Puck, the trickster, has again started troubling people in your city. The people have turned on to you for getting rid of Puck.
Puck presents to you a number consisting of numbers from 0 to 9 characters.
He wants you to count the numbers that he uttered.
Kindly help people to get rid of the Puck by developing a small program .The hope of people are on you so you have to solve the riddleCODING ARENA
#include <stdio.h>
int main()
{
int num,count=0;
scanf("%d",&num);
while(num!=0)
{
num=num/10;
count++;
}
printf("%d",count);
return 0;
}
Test Case 1
Input (stdin)251298
Expected Output6
Test Case 2
Input (stdin)90900
Expected Output5
No comments:
Post a Comment