Skip to content

Commit

Permalink
counting digits in a number
Browse files Browse the repository at this point in the history
  • Loading branch information
suhanigupta23 authored Jan 27, 2024
1 parent 94c8482 commit 86e0fcd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions countingdigitsinnumber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.util.*;
public class Program
{
public static void main(String[] args)
{
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int count=0;
for (;n>0;)
{
n=n/10;
count++;
}
System.out.println(count);
}
}

0 comments on commit 86e0fcd

Please sign in to comment.