Ask Experts Questions for FREE Help !
Ask
    RevolKing's Avatar
    RevolKing Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 23, 2012, 11:45 PM
    Computer C language 5x3 matrix problem
    A common use of an initialized array is to create a look up table. 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 sm1 help me do this?
    I tried but still can't do it.. xC
    kerk93's Avatar
    kerk93 Posts: 1, Reputation: 1
    New Member
     
    #2

    Jul 31, 2012, 10:06 PM
    #include<stdio.h>
    int main(){
    int mat[5][3],I,j,c,s;
    for (I=0;i<5;i++){
    for(j=0;j<1;j++){
    printf("Please keyn in the Number\n");
    scanf("%d",&mat[i][j]);
    mat[i][1]=mat[i][0]*mat[i][0];
    mat[i][2]=mat[i][0]*mat[i][0]*mat[i][0];
    printf("The square of the number is %d\n",mat[i][1]);
    printf("The square of the number is %d\n",mat[i][2]);
    }
    }
    for(j=0;j<3;j++){
    for (I=0;i<5;i++){
    printf("%d\t",mat[i][j]);
    }
    printf("\n");
    }
    system("pause");
    return 0;
    }

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

What does x3 in slang computer language mean? [ 3 Answers ]

I was just wondering what x3 means cause people send it to me on Facebook!

Computer Language [ 1 Answers ]

Hello, I bought my laptop from Morocco, so the operating system is in french. It did not come with the multilingual User Interface pack. DOes anybody know where I can download the english language for my laptop? Thanks.

New to computer language [ 4 Answers ]

How do I access my "favourites" topics which I saved a few days ago on the internet helenkaur

Computer language [ 3 Answers ]

I am new to computer languages. Which computer language should a beginner learn first?


View more questions Search