0
#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();
}

Edited by __avd: Added [code] tags.

4
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by vinitmittal2008
0

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.

Edited by happygeek: fixed formatting

0

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

Edited by Bitllorent: n/a

0

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();
}

Edited by WaltP: Added CODE Tags again. C'mon, it's not rocket science!

0

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;

Edited by vinitmittal2008: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.