92.7k views
5 votes
Convert usernum2 to 0 if usernum2 is greater than 12. Otherwise, print "usernum2 is less than or equal to 12.". End with newline.

1 Answer

6 votes

Answer:

The program to the given question can be given as:

Program:

#include <stdio.h>

//header file.

int main() //main method.

{

int usernum2 = 0;

//define variable.

if(usernum2>12) //check condition

{

printf("usernum2 is less than or equal to 12.\\");

//print value.

}

return 0;

}

Explanation:

In the above C language program first we define an integer variable that is usernum2. In this variable we assign a value that is 0. Then we define the conditional statement in this statement in if block we check usernum2 variable value is greater then 12. if its true it will print "usernum2 is less than or equal to 12".

User Jblixr
by
6.7k points