Hello everyone! In school we've been learning programming in C. Well i knew alot of programming before we learned it but still I'm stuck on a project we had to finish. We got 5 projects and i've completed 4 of them, really easy. We've just been learning the basics like loops, if, else, arrays and easy stuff which i already knew but in this project i have to scan 5 numbers and print them in the opposite order and i don't actually know how i can do this.. I have an example here but i wonder if there are any better ways to do it?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int number1, number2, number3, number4, number5;
printf("Enter five numbers. First number: ");
scanf("%d", &number1);
printf("Second number: ");
scanf("%d", &number2);
printf("Third number: ");
scanf("%d", &number3);
printf("fourth number: ");
scanf("%d", &number4);
printf("fifth number: ");
scanf("%d", &number5);
printf("%d, %d, %d, %d, %d", number5, number4, number3, number2, number1);
getch();
return 0;
}
It doesn't look very good done, does it? Could i use an array or something and do this in a better way? if so, how?