Computer Science, asked by sarahjain2129, 11 months ago


7. Write a program to read two values a and b from user and then print values as a^3 .(a+1)^3
(e.g., if user enters 3 and 7, then the program should print values as per this : 3^3,4^3,5^3,6^3,7^3.....

need to write this program in Java ​

Answers

Answered by Anonymous
31

import java.util.*;

public class Series

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

int a,b,c,i;

System.out.println("Enter the values of the numbers");

a=in.nextInt();

b=in.nextInt();

for(c=a;c<=b;c++)

{

i=Math.pow(c,a);

System.out.println("Print the series="+i);

}

}

}

Explanation:

* In this program we have to start from the first number and have to continue upto the second number.

*Continuously we have to change the number value.

* As we have to change the value continuously so the program is repeatative.

*As the program is repeatative so we have to run the program several times.

* As we have to learn the program several times so instead of writing the program we should use loop here and it will also be beneficial if we change the data values.

For more java programming, solved by me referred to the following link:

brainly.in/question/14335606

brainly.in/question/14323927

brainly.in/question/14370842

brainly.in/question/14395545

brainly.in/question/14809512

https://brainly.in/question/14809885

#answerwithquality

#BAL

Answered by sumit45dt
0

Explanation:

PLEASE MARK ME AS BRAINLIST

Attachments:
Similar questions