IF STATEMENT

It’s a conditional statement.

#include<stdio.h>

void main(){

int x=10;

int y=20;

Cond 1.     (x==y)       o/p false     == comparision operator (10==20) false

Here we are compare2 values

Cond 2.   (x!=y)     o/p true     != not equal operator       (10!=20)  true

Cond 3.   (x<y)      o/p  true     <  less than operator   (10<20)   true

Cond 4.  (x>y)     o/p   false      >  greater then operator   (10>20)  false

Cond 5.  (x<=y)   o/p  true      <=  less then equal operator    (10<=20)  true

Cond 6.  (x>=y)   o/p false      >= greater then equal operator (10>=20) false

}

These above expression always gives Boolean values as output which means value can be either true or false.

#include<stdio.h>

void main()

{

  int money = 100000;

  if(money>90000){

  printf(“bhandara”);

}

}  

If condition means , if the expression provided gives true then the code defined in if condition will execute.

Write the above code using scanf and take money value as input from user.

#include<stdio.h>

void main()

{

  int money;

  printf(“plese enter the money”);

  scanf(“%d”,&money);

  if(money>90000)

{

  printf(“bhandara”);

}

}

Input 100000

Output : bhandara

This code is used to show your status write salary

#include<stdio.h>

void main()

{

  int salary;

  printf(“pleas enter your salary”);

  scanf(“%d”,&salary);

  if(salary>100000){

  printf(“you have a good salary”);

}

}

 This code is to demonstrated if else on person has hair or not.

#include<stdio.h>

void main()

{

  int hair;

  printf(“pleas enter your hair on head”);

  scanf(“%d”,&hair);

  if(hair>0){

  printf(“you have hairs”);

}

  else

{

  printf(“you don’t have hairs”);

}

}

Wap to convert second into hours, min & seconds

#include<stdio.h>

void main()

{

  int a,b,c;

  printf(“enter the seconds”);

  scanf(“%d”,&a);

  b=a%3600;

  a=a%3600;

  c=a/60;

  d=a%60;

  printf(“\n hours = %d”, b);

  printf(“\n minuts %d”, c);

  printf(“\n seconds %d”, a);