Ticker

6/recent/ticker-posts

C Language (If else statement)

IF ELSE STATEMENT IN C
The If else statement is used to implement atmost two logical conditions. 

Example 1: Program to print result by If else
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int m;
printf("Enter your marks:");
scanf("%d",&m);
if(m >= 33)
{
printf("Pass");
}
else
printf("Fail");
getch();
}

- - - OUTPUT - - -
Enter your marks: 35
Pass


Example 2: Even odd program in C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
printf("Enter any number:");
scanf("%d",&n);
if(n%2 == 0)
{
printf("Even");
}
else
printf("Odd");
getch();
}

- - - OUTPUT - - -
Enter any number: 3
Odd


Example 3: Leap year program in C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int year;
printf("Enter the year");
scanf("%d",&year);
if(year%4 == 0)
{
printf("Leap year");
}
else
printf("Not leap year");
getch();
}

- - - OUTPUT - - -
Enter the year: 2019
Not leap year


























Post a Comment

6 Comments

  1. please tell me how to earn rupee to paytm from blog

    ReplyDelete
  2. Very soon I'll upload article, how to earn from blogging so keep visiting ...

    ReplyDelete
  3. Replies
    1. I am writing an article on this topic and within just two days I'll post it, on my "Techno Tricks" post, so keep visiting, thanks ...

      Delete
  4. how to get ads tellllllllllllllllllllllll meeeeeeeeeeeeeee plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

    ReplyDelete
    Replies
    1. First your blog should be six months old along with 20-30 post then apply for adsense ads.....

      Delete