Computer Science, asked by rosalinrawat50, 7 months ago

write a program to input a number and check its 1 digit 2 digit 3 digit or more than three digit number ​

Answers

Answered by jaydeep9090
1

Answer:

Plz thanx me and make me brainlist then I will follow u and take free points Ok and plz follow me plz and take free points Ok and plz follow me plz and take free points Ok an d and make me brainlist then I will follow u and take free points Ok and plz

Answered by anindyaadhikari13
5

Question:-

  • Write a program to input a number and check if it's 1digit,2 digit, 3 digit or more than 3 digit number.

Program:-

This is written in Java.

import java.util.*;

class Digit

{

public static void main()

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter a number: ");

int n=sc.nextInt();

int c=0;

while(n!=0)

{

c++;

n/=10;

}

if(c<=3)

System.out.println("Number is a "+c+" digit number.");

else

System.out.println("Number of digits is more than 3.");

}

*)

Similar questions