Computer Science, asked by ChimChimsKookie, 5 months ago

do this... It's Java Programming​

Attachments:

Answers

Answered by anindyaadhikari13
4

Required Answer:-

Question:

  • Write a Java program to print the squares of all the numbers from x to y.

Solution:

Here comes the program.

import java.util.*;

public class Squares {

 public static void main(String[] args) {

    int x, y;

    Scanner sc=new Scanner(System.in);

    System.out.print("Enter x - ");

    x=sc.nextInt();

    System.out.print("Enter y - ");

    y=sc.nextInt();

    System.out.println("Squares of numbers in range "+x+" to "+y+" are..");

    while(x<=y) {

       System.out.print(x*x+" ");

       x++;

    }

    sc.close();

 }

}

Algorithm:

  • START
  • Accept the range from the user, say x - y.
  • Display the squares of numbers in the range x - y.
  • STOP.

See the attachment for output.

Attachments:
Answered by Moncheri06
3

\huge \mathbb \fcolorbox{black}{plum}{Answer}

Yeah Jessica

what m I

A PoTAEto

I m also your chiingu T_T

Similar questions