Monday, April 13, 2020

Conditional operator in C

  • Program :
#include <stdio.h>
#include<conio.h> 
void main()
{
   int m,n;
   clrscr();
   printf("\n----------------CONDITIONAL OPERATOR(?:)----------------");
   printf("\nEnter M and N values:");
   scanf("%d%d",&m,&n);
   n=(m==1?2:0) ;
   printf("\nm value is : %d",m);
   printf("\nn value is : %d",n);
   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...