Tuesday, April 14, 2020

If-else statement in C

  • Flowchart :
  • Syntax :
if (condition)
{
    // Executes this block if
    // condition is true
}
else
{
    // Executes this block if
    // condition is false
}
  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
  int a;
  clrscr();
  printf("\n----------------IF-ELSE STATEMENT----------------");
  printf("\nEnter your age :");
  scanf("%d",&a);
  if(a>=18)
  printf("\nYou are a major");
  else
  printf("\nYou are not a major"); 
  getch();
}

  • Output :




No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...