Search This Blog

Friday, October 7, 2011

Illustrate the use of ternary operator

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  int x,a;
   6:  printf("Enter the value of a:");
   7:  scanf("%d",&a);
   8:  x=(a>8)?a+1:9;
   9:  printf("x= %d\n",x);
  10:  getch();
  11:  }

No comments:

Post a Comment