New Programmer needs help! Very Easy Question!
I am a beginner programmer and tried to write a code to calculate whether you are an official adult or not. Whenever i type in my age and press return, it goes on to a new line and makes me type more before i can continue. What is wrong? Here is my code...
Code:
#include <stdio.h>
int age;
int const senior = 61;
int const adult = 18;
int main ()
{
printf ("Input Age\n");
scanf ("%d\n", &age);
if (age >= adult && age<= senior)
printf ("you are a legal adult\n");
else
printf ("you are not an adult\n");
system ("PAUSE");
return 0;
}
Notice how i had to use system pause because on my computer whenever i run the program it quits right after its finished calculating. Is there a simple way to insert system ("PAUSE") after all of my code automatically?