ALEx604
asked on
IF's in C (syntax?)
Ok. trying to figure out why this doesn't work and I am lost, I am pretty sure it has to do with syntax.
(PS I will judge the correct answer with at least 50 points when I have it, if there is a big change I'll give more points, Also if you include other common errors newbies make with "if statements" I'll increase the points as well)
int main(int argc, char *argv[])
{
printf( "This is a Hello World Program\n ");
int interger1 ;
int interger2 ;
int interger3 ;
int sum ;
printf( "\n Enter a number: \n");
scanf( "%d" , &interger1 ) ;
printf( "\n Enter another number: \n");
scanf( "%d" , &interger2 ) ;
printf( "\n Enter how much difference is allowed:\n");
scanf( "%d" , &interger3 ) ;
if ( interger1 <= interger2 ) {
sum = interger1 - interger2 ;
}
else if ( interger1 > interger2 ){
sum = interger2 - interger1 ;
}
if ( interger3 >= sum ){
printf("\n\nIt's to much of a difference\n\n");}
else if ( interger3 < sum ){
printf("\n\nThis is not to much of a difference\n\n");}
return EXIT_SUCCESS;
}
(PS I will judge the correct answer with at least 50 points when I have it, if there is a big change I'll give more points, Also if you include other common errors newbies make with "if statements" I'll increase the points as well)
int main(int argc, char *argv[])
{
printf( "This is a Hello World Program\n ");
int interger1 ;
int interger2 ;
int interger3 ;
int sum ;
printf( "\n Enter a number: \n");
scanf( "%d" , &interger1 ) ;
printf( "\n Enter another number: \n");
scanf( "%d" , &interger2 ) ;
printf( "\n Enter how much difference is allowed:\n");
scanf( "%d" , &interger3 ) ;
if ( interger1 <= interger2 ) {
sum = interger1 - interger2 ;
}
else if ( interger1 > interger2 ){
sum = interger2 - interger1 ;
}
if ( interger3 >= sum ){
printf("\n\nIt's to much of a difference\n\n");}
else if ( interger3 < sum ){
printf("\n\nThis is not to much of a difference\n\n");}
return EXIT_SUCCESS;
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will review each of the above and get back to you with any error codes including the orginial.
( Points will take some time I think since I would like to increase it to at least 125 )