Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.

Respuesta :

Following are the code in c language

#include <stdio.h>  // header file

int main()  // main function

{

   float gpa=4.5;  // assuming variable

   int deansList=8;

   char studentName[45]="patel";

if (gpa > 3.5)  // checking condition gpa exceeds 3.5.

{

deansList++;  // add 1 to deanslist

printf("%s", studentName);  // prints student name

}

return 0;

}

Explanation:

In this program we declared and initialized variables "gpa" with 3 of type "float", "deansList"   with 8 of type "int" and "studentName" with "Patel" of type "char array". after that we check  the condition if "gpa" exceed 3.5,  then the block of if is executed and  it increment the value  of "deansList" by 1 and print the studentName .

output

patel

ACCESS MORE