Ask Question
6 January, 21:38

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.

+1
Answers (1)
  1. 7 January, 01:26
    0
    Following are the code in c language

    #include / / 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
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to deansList ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers