1:
#include <stdio.h>
///conditional operator:
int main ()
{
int a,b,c;
a=5;b=10;
c=(a<b)? a:b;
printf("%d",c);
return 0;
}
output: 5
2:
#include <stdio.h>
///conditional operator:
int main ()
{
int a,b,c;
a=5;b=10;
c=(a>b)? a:b;
printf("%d",c);
return 0;
}
output: 10
3:
#include <stdio.h>
///comma operator:
int main()
{
int a,b,cma;
cma=(a=7,b=5,a-b);
printf("%d",cma);
return 0;
}
output: 2
4:
#include <stdio.h>
int main()
{
int a=5,b=6;
printf("%d %d %d",a,b,a+b);
return 0;
}
output: 5 6 11
No comments:
Post a Comment