this is question and the answer...but i cannot compile it in dev c++ correctly..help me

//(a) Get five integer numbers from the user.
//( Store the numbers in an array called Number.
//© Display all the numbers on screen.
//(d) Modify the program so that it prints the reverse of the numbers.


//CONTOH OUTPUT :

//Enter numbers : 1
//Enter numbers : 2
//Enter numbers : 3
//Enter numbers : 4
//Enter numbers : 5


//1 2 3 4 5

//5 4 3 2 1

//Press any key to continue

#include<stdio.h>

 main()

{
    int i,Number[5];

    for (i=0; i<5; i++)
    
    {
        printf("Enter Number:    ");
        scanf("%d" ,&Number[i]);


    }


    for (i=0; i<5; i++)
    {
    
        printf("%d\t" ,Number[i]);

    }

    printf("\n");
            
    for(i=4; i>=0; i--)
    {

        printf("%d\t", Number[i]);


    }
    

}

help me to find the wrong

Recommended Answers

All 4 Replies

Hi its sth simple:

int main()
{

....
return 0;
}

post the error message(s)

line 3: should be int main() -- functions require a return type.

abov e program can also be written as:

void main()
{
------
-----
getch();
}

abov e program can also be written as:

void main()
{
------
-----
getch();
}

Yes, it can be...if you want your code to be subtly broken and non-portable. The main function returns int by definition. getch isn't a standard function, so you'd be relying on a library extension specific to your compiler.

The only way you could be more completely wrong is to introduce syntax errors into one of the four "this is real code" lines of that example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.