Write a program to to show the working of IF condition using global variable.

4/19/2013 06:32:00 pm Unknown 0 Comments



#include <stdio.h>
#include <conio.h>
int a; // it is a global variable
main ()
{
  printf("enter the value of n="); // prompt
  scanf("%d",&a); //get value for integer a
  if (a==10) //if condition
printf("YOU HAVE 10 RS"); //prompt
else //if condition is wrong than it is execute
{
      printf("you have nothing"); //promt
        }
  getch();// hold screen until you enter a key.
}