Knowee
Questions
Features
Study Tools

What will be the output of the following program?#include<stdio.h>int main(){int i=10;if (i > 10)elseprintf ( "Hello Cocaine!" );return 0;}ans.

Question

What will be the output of the following program?#include<stdio.h>int main(){int i=10;if (i > 10)elseprintf ( "Hello Cocaine!" );return 0;}ans.

🧐 Not the exact question you are looking for?Go ask a question

Solution

The program you've written is incomplete and will not compile. The if statement is missing a condition. Here is the corrected version:

#include<stdio.h>

int main(){
    int i=10;
    if (i > 10){
        // some code here
    }
    else{
        printf ( "Hello Cocaine!" );
    }
    return 0;
}

In this corrected version, the program checks if the variable i is greater than 10. If i is greater than 10, it will execute the code inside the if statement. If i is not greater than 10, it will print "Hello Cocaine!" to the console.

Since i is set to 10 and 10 is not greater than 10, the output of this program will be "Hello Cocaine!".

This problem has been solved

Similar Questions

What is the output of the following C Program?

What will be the output of the following code?

what will be the output of the c program?

What will be the output of the following C++ code?

What will be the output of the following program?Note: This question helps in clearing the AMCAT exam

1/4

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.