[source code] C Programming Tutorial - 21 - Don't Beat Up Little Kids

+3 Bucky Roberts · August 4, 2014



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int hoursWorked = 25;

    if( (hoursWorked >= 10) && (hoursWorked <= 40) ){
        printf("Nice job hoss");
    }else{
        printf("You're fired");
    }

    return 0;
}


Post a Reply

Replies

Oldest  Newest  Rating
0 Jon L · August 21, 2014
That's not the right code for #21. But in the tutorial you tell us that both questions are separated with a && and both must be TRUE in order for the program to execute the  printf statement. But you didn't say what if the kid studies 60 hrs and beat up 9 kids how would we get it to print something like " Your doing a good job studying but you need anger management." Did i miss something or what.

Great job tho Bucky i'm at #25 and have memorized and masters all sample programs thanks.
  • 1

C

124,405 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator