Answer to Question #244596 in C++ for Prashant Thakur

Question #244596
Programs are much more useful if they can make decisions about what tasks need to be performed. Making a decision in a C programi usually involves testing the value of one or more variables. Which concept will be used? Explain it with the help of suitable examples.
1
Expert's answer
2021-09-29T18:44:33-0400
In C programming language if else statements can be used to make decisions on which task
needs to be performed. 
For example, the following code uses if else statement to print some messages.
#include<stdio.h>
int main(){
	int x = 2;
	if(x==2){
		printf("If block of code executed\n");
	}
	else{
		printf("else block of code executed\n");
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS