In C please:
Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Convert userNum2 to 0 if userNum2 is greater than 10. Otherwise, print "userNum2 is less than or equal to 10.". End with newline.
#include
int main(void) {
int userNum1;
int userNum2;
userNum1 = 1;
userNum2 = 14;

/* Your solution goes here */

printf("userNum2 is %d.\n", userNum2);
return 0;
}

Respuesta :

Answer:

The C code is explained below. The highlighted code represents the "your solution goes here" section

Explanation:

//Header file section

#include <stdio.h>

//Program begins with a main method

int main(void)

{

//Declare the integer variables

int userNum1;

int userNum2;

//Initialized the values to the variables

userNum1 = 1;

userNum2 = 14;

// If userNum1 is less than 0, then print "userNum1 is negative".

// '\n' represents end with newline

if (userNum1<0)

{

 printf("userNum1 is negative. \n");

}

//If userNum2 is greater than 10, then convert userNum2 to 0.

//Otherwise, print "userNum2 is less than or equal to 10"

if (userNum2>10)

{

 userNum2 = 0;

}

else

{

 printf("userNum2 is less than or equal to 10.");

 //'\n' represents end with newline

 printf("\n");

}

//Print userNum2 value

printf("userNum2 is %d. \n", userNum2);

return 0;

}

RELAXING NOICE
Relax