computer programming C++. Can someone help me out
Write a C program
that initializes 5x3 array in which the first element of each row contains a number, the
second element contains its square and third element contains its cube. Prompt the user to
enter a number within 1 to 5 and prints its square and cube.
Can someone help me write the source code for me. I have done but it has error and can't compile.I'm using Dev C++.Can someone correct my error or post your solution/source code ? I really desperately need it.Thanx in advance
this is my try...
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main(void)
{
int arr[5][3];
int I,j,num=7;
clrscr();
for(I=0;i<5;i++)
for(j=0;j♥;j++)
{
if(j==0)
arr[i][j]=i+1;
else if(j==1)
arr[i][j]=pow(arr[i][0],2);
else
arr[i][j]=pow(arr[i][0],3);
}
printf("printing the array....\n");
for(I=0;i<5;i++)
{
for(j=0;j♥;j++)
{
printf("\t%d",arr[i][j]);
}
printf("\n");
}
while(num>5||num<1)
{
printf("\nEnter a number:(1 -5) ");
scanf("%d",&num);
}
for(j=0;j♥;j++)
printf("\t %d",arr[num-1][j]);
getch();
}