Ask Experts Questions for FREE Help !
Ask
    Rubentheran's Avatar
    Rubentheran Posts: 35, Reputation: 1
    Junior Member
     
    #1

    Jul 27, 2011, 04:11 AM
    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();
    }
    iyyazahmad345's Avatar
    iyyazahmad345 Posts: 1, Reputation: 1
    New Member
     
    #2

    Oct 5, 2011, 05:59 AM
    Hi,

    I just saw the problem. Actually Clrscr() doesn't support in dev c++. It will work in turbo c. So you should use system("cls") instead of Clrscr().

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!

Computer programming in factorial.Need help [ 1 Answers ]

Question is in attachment because I can't post the image here.The question is in the attachment.Currently, I don't know how to start because its very difficult.I even studied the textbook and references but I'm still unable to solve it.Can someone help me this out by giving the guide to start.I...

Computer Science & Programming Differences [ 3 Answers ]

What are the differences? I want to work with Java, C++, Perl, and other stuff but I can't find the approprate stuff. Maybe because I'm 15. But could one of you all help me. Thanks.

Computer programming [ 2 Answers ]

How do yeah teach a computer the meaning of nothing?


View more questions Search