if block

The if statement/block evaluates the test condition inside the parenthesis. If the test condition is true then statements inside the body of if block will be executed otherwise program control will be shifted to next statement of program.
if स्टेटमेंट या ब्लॉक का प्रयोग टेस्ट कंडीशन को जांचने के लिए किया जाता है यदि टेस्ट कंडीशन सत्य है तब if ब्लॉक के स्टेटमेंट रन किये जायेंगे अन्यथा प्रोग्राम कंट्रोल प्रोग्राम के अगले स्टेटमेंट पर पहुँच जायेगा। 
Syntax:-
if(condition) statement;

if(condition){
statements;
.................
}
Example:-
C++ program to print I division when percentage of student is given.
#include<iostream.h>
#include<conio.h>
void main(){
float per;
clrscr();
cout<<"Enter Percentage of student"<<endl;
cin>>per;
if(per>=60){
cout<<"I Division "<<per<<"%"<<endl;
}
getch();
}

No comments:

Post a Comment