Saturday, August 18, 2018

HEENA CHALLENGE


  • Problem Description

    Heena gave a number to Jonnes and ask him to count the number of digits in a number. Sheela tries one simple logic to do that. So she decided to apply this concept in C.
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int n,count=0;
      scanf("%d",&n);
      while(n>0)
      {
        n=n/10;
        count=count+1;
      }
      printf("%d",count);
        
      

    return 0;
    }
  • Test Case 1

    Input (stdin)
    8952
    
    
    Expected Output
    4
  • Test Case 2

    Input (stdin)
    62356
    
    
    Expected Output
    5

No comments:

Post a Comment