+ 1

Is it possible to make both condition in if else to true and print corresponding following statements for both

23rd Feb 2017, 4:15 PM
prijesh
prijesh - avatar
6 Respuestas
+ 12
No. Your else statement is always the complement of your if statement and will only run when your if statement is false.
23rd Feb 2017, 4:19 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
You Can't!
23rd Feb 2017, 4:18 PM
Mr.Robot
Mr.Robot - avatar
+ 6
@prijesh, if the condition is true and the if statement is executed then else statement will be skipped likewise if condition is false it will skip the if statement and execute the else statement.
23rd Feb 2017, 4:34 PM
Mr.Robot
Mr.Robot - avatar
+ 2
Yes u can #include<stdio.h> #include<conio.h> void main() { clrscr(); if (!(printf("hello"))) ; else printf("bye"); getch(); } //we all know that printf(), scanf(), exit() returns zero hence by adding ! It makes the value false so it prints if statement as well as else statement and the symbol ; terminates the statement :3 /*now apply this trick with all ur frnds n njoy*/ ;) The code is being fully tested and this is how the output looks like with both if and else statement
28th Jan 2020, 7:23 AM
Rimjhim Pandey
Rimjhim Pandey - avatar
+ 1
hasty rei is it possible to print something in if condition and make it false to print else condition
23rd Feb 2017, 4:32 PM
prijesh
prijesh - avatar
0
@Mr.robot I am trying to say like if(print()==0)else print()
23rd Feb 2017, 4:40 PM
prijesh
prijesh - avatar