Write a program in C++ to display the following number series.
1 8 27 64
Answers
Answered by
2
Answer:
#include<iostream>
using namespace std;
int main()
{
for(int i=1;i<=4;i++)
{
cout<<i*i*i<<endl;
}
}
Explanation:
output:
1
8
27
64
Answered by
4
Answer:
This is the required C++ program for the question.
#include <iostream>
using namespace std;
int main() {
int n,i;
cout << "Enter limit - ";
cin >>n;
for(i=1;i<=n;i++) {
cout << i*i*i << " ";
}
return 0;
}
Algorithm:
- Accepting the limit from the user.
- Iterating numbers from 1 to the given range.
- Display the cube of each numbers in the range.
See the attachment for output.
Attachments:
Similar questions