write a program using only if statement.
IF Statement is conditional statements, work only if Condition is true. in case we not mention else part, it is Only If Condition.
if(condition){
Statement
}
Program
//Write a Program of Decision making statements using If
#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int age=0;
cout<<" Only If Program ";
cout<<"\n-----------------";
cout<<"\nEnter The Age : ";
cin>>age;
if(age>18){
cout<<"Your age is Greater Then 18 You Can Also Vote, ";
}
cout<<"Yours Age is "<<age;
getch();
}
Output / Result
(Visited 284 times, 1 visits today)
