Series 0.1, 0.11, 0 .111,......

WAP to print the sequence 0.1, 0.11, 0.111 ............


import java.util.Scanner;

class Series3

{

    public static void main()

    {

        System.out.println("Enter the number upto which you want the Sequence");

        Scanner in = new Scanner(System.in);

        int x = in.nextInt();

        double a=0.1;

        for(int i=1;i<x;i++)

        { 

            System.out.print(a+", ");

            a= a+ Math.pow(10,(-i-1));

        }

        System.out.print((a)+". ");

    }

}



For Any Desired Program comment below. WE WILL TRY OUR BEST TO MAKE THAT PROGRAM AVAILABLE.

Comments

  1. Wap to check for a pronic no.

    ReplyDelete
    Replies
    1. check out here https://intuition4science.blogspot.com/2020/07/find-number-is-pronic-or-not.html

      Share this in your group... Contact whatsapp 7004646949

      Delete

Post a Comment

Popular Posts