Computer Science, asked by rishiyaduvanshi70, 5 months ago

Write a program to display the cube of the number upto given an integer. Test Data :Input number of terms : 5Expected Output :Number is : 1 and cube of the 1 is :1Number is : 2 and cube of the 2 is :8Number is : 3 and cube of the 3 is :27Number is : 4 and cube of the 4 is :64Number is : 5 and cube of the 5 is :125​

Answers

Answered by bannybannyavvari
7

Answer:

Mendeleevs Periodic Law: Properties of elements are the periodic function of their atomic masses. Achievements:i It could classify all the elements discovered at that time. ii It helped in the discovery of new elements. iii it helped in the correction of the atomic mass of some of the elements.

Answered by anindyaadhikari13
0

Answer:

Here comes the answer to your question.

1. In Java.

import java.util.*;

public class Java {

public static void main(String[] args) {

Scanner sc=new Scanner(System .in);

int n, i;

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

n=sc.nextInt();

for(i=1;i<=n;i++) {

System.out.println("Number is: "+i);

System.out.println("Cube of the number: "+i * i * i);

System.out.println();

}

sc.close();

}

}

2. In Python.

n=int(input("Enter limit - "))

for i in range(1,n+1):

print("Number is: ",i)

print("Cube of the number is: ",i * * 3)

print()

3. In C

#include <stdio.h>

void main() {

int n, i;

printf("Enter limit - ");

scanf("%d", &n);

for(i=1;i<=n;i++) {

printf("Number is: %d\n", i);

printf("Cube of the number is: %d\n\n",i * i * i);

}

}

4. In C++

#include <iostream>

using namespace std;

int main() {

int i,n;

cout << "Enter limit - ";

cin >> n;

for(i=1;i<=n;i++) {

cout << "Number is: "<< i << endl;

cout << "Cube of the Number is: "<< i * i * i << endl << endl;

}

return 0;

}

Algorithm:

  1. START.
  2. Accept the range (n).
  3. Iterate a loop in the range i=1 to n.
  4. Display the value of i and cube of i.
  5. STOP.

See the attachment for output ☑.

Attachments:
Similar questions