im pretty new so this is probably really simple, but i cant figure it out. i enter in--------------
Code:
#include <stdio.h>
int main()
{
int age;
printf( "Please enter your age." );
scanf( "%d", &age );
if( age <=50 ) {
printf( "damn your young." );
}
else if( age >=51 ) {
printf( "your old." );
}
}
and the first printf comes up fine but once i put in a number, and press enter, the window and program closes. then i even copy and pasted this from the tutorial site----
Code:
#include <stdio.h>
int main() /* Most important part of the program!
*/
{
int age; /* Need a variable... */
printf( "Please enter your age" ); /* Asks for age */
scanf( "%d", &age ); /* The input is put in age */
if ( age < 100 ) { /* If the age is less than 100 */
printf ("You are pretty young!\n" ); /* Just to show you it works... */
}
else if ( age == 100 ) { /* I use else just to show an example */
printf( "You are old\n" );
}
else {
printf( "You are really old\n" ); /* Executed if no other statement is
*/
}
return 0;
}
and it did the same thing. after i put in a number, and hit enter, the program window closed. i dont know if its a programming error or compiler error. my source code is set to console application in C(sure of it, checked 3 times lol). can anyone please give me some help on how to make the entire program run?