If Statement: if statements is one of the powerful conditional statement it is use for condition in c program . When we use if statements then we use relational operator ==
< >, ! , etc .
if (condition){Statements;}
Program 1:) x is greater than y
#include <stdio.h>
int main()
{
int x=5;
int y=3;
if(x>y)
{
printf("x is greater than y");
}
return 0;
}
Output: x is greater than y
For Run this Program Copy code and click - Run_Program
Program 2:) x is equal to y
#include <stdio.h>
#include <conio.h>
int main(){int x;int y;printf("Enter the x value ");scanf("%d",&x);
printf("Enter the y value ");scanf("%d",&y);if(x==y){printf("x is equal to y");}return 0;}
Output : x is equal to y
For Run this Program Copy code and click - Run_Program
0 Comments
यदि आपको यह पोस्ट अच्छी लगी हो तो आप हमें कमेंट में बताएं