Program to execute both if and else statements simultaneously

1 year ago Admin 2

Execute both if and else statements simultaneously

This article illustrates the concept how to execute both if and else statements simultaneously in c/c++.

execute both if and else statements simultaneously

Here is the source code and output of both the programs.

C Programming language

Program


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
if(!printf("Running if condition"))
{
 printf("Running if condition") ;
}
else
{
 printf("\nRunning else condition");
}
getch();
}

After successfully compiling and executing the above C program,output is:-

execute both if and else statements simultaneously


C++ Programming language

Program


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
if(!cout<<"Running if condition")
{
 cout<<"Running if condition" ;
}
else
{
 cout<<"\nRunning else condition";
}
getch();
}

After successfully compiling and executing the above C++ program,output is:-

execute both if and else statements simultaneously


Comment below if you are facing any problem or you find any error in the above program and also subscribe to our newsletter for more updates.


Read more c/c++ Programs published by snapcout:-

Program to print hello world without using semicolon
Program to find greatest between two numbers without using if else
Program to sort a string in alphabetic order
Program to find ascii value using function toascii()
Program to check palindrome number using recursion


About article

Written By:- Admin

Published on:- 10/04/2018

Published By:- Snapcout


Don't forget to share the article if you like it:-