#include<stdio.h>
#include<conio.h>
void main(void)
{
	int a1,a2,a3,a4,a5;
	clrscr();
	scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5);
	printf("%d%d%d%d%d",a5,a4,a3,a2,a1);
	getch();
}

Recommended Answers

All 4 Replies

This reeks of a homework assignment, so I'm not going to provide any code at this time.

FYI, this is the C++ forum, there is a separate C forum.

Also, please use code tags when posting code in the future. They make the code in your post easier to read.

First, I would get rid of the conio header and associated functions.

Then, change main() to properly return an int and add the appropriate return statement.

After that, declare an array instead of a collection of int variables and use pointer arithmetic.

Also, look up for loops after you're done following Fbody's suggestions.

sorry about that from now on i will try my best to answer the codes and thx for the clue you give me try to answer it by myself this is the code so far:

#include<stdio.h>
void main(void)
{
     int i,a[5];
     for(i = 0,i < 5;i++)
         {
         printf("Enter a number:");
         scanf("%d",&a[i]);
         }
     for(i = 4;i >=0; i--)
             printf("%d",a[i]);
     getch();
}

Embed your program code between code tags..
and use

int main(void)

instead of

void main(void)

Remove getch() from the end
main always return a integer value so use

return 0;

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.