Cube of a Number

This program is used to find the cube of a number from 1 to 10.In this program ,user is not asked to enter any number manualy.This program will automatically count the cube of all numbers between 1 and 10.While loop is used in it.Cube of a number is computed by multiplying the entered number three times.Similarly we can compute the cubes of number by varying the range.

CODE

//to find the  cube of the number from 1 to 10
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int count;
count=1;
cout<<" ----www.AhirLabs.com----"<<endl;
while(count<=10)
{
cout<<" Cube of "<<count<<" is "<<count*count*count<<endl;
cout<<" ------------------------"<<endl;

count++;
}
getch();
}

OUTPUT

cube
cube
(Visited 668 times, 1 visits today)
Share with Friends :
Written by: