13 comments:

  1. import java.util.Scanner;
    class Length
    {
    public static void main(String Args[])
    {
    System.out.println("enter the integer");
    Scanner sc=new Scanner(System.in);
    double num=sc.nextDouble();
    int n=(int)num;
    int length=0;
    while(n!=0)
    {
    length++;
    n=n/10;
    }
    System.out.println("length of number is"+length);
    }
    }

    ReplyDelete
  2. import java.util.Scanner;

    class Test{

    public static void main(String ar[])
    {

    Scanner sc=new Scanner(System.in);
    double number;
    int count=0,no;
    System.out.println("Enter Number to check Length");
    number=sc.nextDouble();
    no=(int)number;
    while(no>0)
    {
    count++;
    no=no/10;
    }
    System.out.println("Length = "+count);



    }
    }

    ReplyDelete
  3. import java.util.Scanner;
    class LengthNumber
    {
    public static void main(String ar[])
    {
    int Length=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter thee Number");
    int Number=scan.nextInt();
    while(Number>0)
    {
    Number=Number/10;
    Length++;
    }
    System.out.println("Length of a number="+Length);
    }
    }

    ReplyDelete
  4. import java.util.Scanner;

    class Test
    {

    public static void main(String ar[])
    {
    double number;
    int i,number1;
    System.out.print("Enter the number: ");
    Scanner o= new Scanner(System.in);
    number=o.nextDouble();
    number1=(int)number;
    for(i=0;number1>0;i++)
    {
    number1=number1/10;
    }
    System.out.println("The length of the number is: "+i);

    }
    }

    ReplyDelete
  5. $num1=$_POST["num"];
    $length=0;
    $temp=$num1;
    while($temp>=1)
    {
    $temp/=10;
    $length++;
    }
    echo "Length of $num1= $length";

    ReplyDelete
  6. 7.
    import java.util.Scanner;
    class A
    {
    public static void main(String args[])
    {
    Scanner obj=new Scanner(System.in);
    int num;
    int i=0;
    num=obj.nextInt();
    while(num!=0)
    {
    num=num/10;
    i++;
    }
    System.out.println("The length of the given number is ="+i);
    }
    }

    ReplyDelete
  7. import java.util.Scanner;
    class lengthofno {
    public static void main(String ar[])
    {
    Scanner scan = new Scanner(System.in);
    int count = 0 , remainder , number;
    System.out.println("Enter the number");
    number = scan.nextInt();
    while(number!=0)
    {
    remainder = number % 10;
    count++;
    number /= 10;
    }
    System.out.println("the length is :" +count);

    }

    }

    ReplyDelete
  8. import java.util.Scanner;
    class Length{
    public static void main(String ar[]){
    Scanner obj=new Scanner(System.in);
    int number,i;
    System.out.println("enter the number whose length is to be found" );
    number=obj.nextInt();
    i=0;
    while(number!=0)
    {
    number=number/10;
    i++;
    }
    System.out.println("the length of the number is"+i);
    }
    }

    ReplyDelete
  9. import java.util.Scanner;

    class Length{

    public static void main(String ar[]){
    int number;
    int temp=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the number:");
    number=scan.nextInt();
    while(number>0){
    number=number/10;
    temp++;
    }
    System.out.println("The length is:"+temp);
    }
    }

    ReplyDelete
  10. import java.util.Scanner;
    class Length{
    public static void main(String ar[]){
    int number,length=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the number");
    number=scan.nextInt();

    while(number>0){
    number=number/10;
    length++;

    }
    System.out.println("length of the number="+length);
    }
    }

    ReplyDelete
  11. import java.util.Scanner;
    class Length{
    public static void main(String ar[]){
    Scanner s=new Scanner(System.in);
    int a,temp=0;
    System.out.println("enter a number");
    a=s.nextInt();
    while(a>0)
    {
    a=a/10;

    temp++;
    } //here if i`ll print statement inside while it`ll print the statement as many times as while will run.
    System.out.println("length"+temp);
    }
    }

    ReplyDelete
  12. package com.example.myapplication;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;

    public class LengthOfInteger extends Activity {

    int num,length=0;
    Button btlength;
    TextView Result;
    EditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.length_of_integer);

    btlength=findViewById(R.id.button);
    Result=findViewById(R.id.textView);
    editText=findViewById(R.id.editText);

    btlength.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    num = Integer.parseInt(editText.getText().toString());
    while (num > 0) {
    //length++; (or)
    num = num / 10;
    length = length + 1;

    }
    Result.setText("Result=" + length);
    }
    });
    }
    }

    ReplyDelete
  13. import java.util.Scanner;
    public class Lenghtcount{
    public static void main(String[]ar){
    int Lenght=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the Number \n");
    int Number=scan.nextInt();
    while(Number>0)
    {
    Number=Number/10;
    Lenght++;
    }
    System.out.println("lenght of a number="+Lenght);
    }

    }

    ReplyDelete