Friday, June 4, 2021

PROGRAM to calculate the cube of any number using for loop (POP) (126)

#include<iostream>

using namespace std;

int main()

{

int i,n;

cout<<"please enter the number:";

cin>>n;

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

{

cout<<"the number is:"<<i<<endl;

cout<<"the cube is:"<<i*i*i<<endl;

}

} 

No comments:

Post a Comment