Write a program to store 10 numbers in an array and print the cube of numbers
placed at odd subscript positions
Answers
Answered by
3
Explanation:
Let's use c++
code:-
#include<iostream.h>
#include<conio.h>
void main()
{
//clear the screen.
clrscr();
//declare variable type int
int a[10],i,cube;
//Input the two numbers save them in arrays.
//Here for loop is used to input multiple numbers in array.
for(i=0;i<5;i++)
{
cout<<"Enter the no."<<endl;
cin>>a[i];
}
//cout
cout<<"Cubes are :- ";
//show the output cube of arrays
for(i=0;i<5;i++)
{
cube=a[i]*a[i]*a[i];
cout<<cube<<" ";
}
//get character
getch();
}
Similar questions