Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
 // variables
 int n=5;
 int k,total=0;
 int copy=n;
 // while loop to calculate cubes
 while(n)
 {
 // find cube
 k=n*n*n;
 // find total
 total=total+k;
 // decrease n
 n--;
 }
 // print sum of cubes of first n whole numbers
 cout<<"Sum of cube of first "<<copy<<" numbers is "<<total<<endl;
 return 0;
}
Step-by-step explanation:
Declare three variables n, k and total. initialize n with 5.In the while loop, calculate cube of n then add it to total.Then decrease the n by 1.While loop run until n becomes 0.After the while loop,total will have the sum of cubes of first n whole numbers.
Output:
Sum of cube of first 5 numbers is 225