- Display output without using semicolon ";" .
Here it is shown that how to display output without using semicolon ";" at the end of line.
#include <iostream.h>
int main()
{
int t,c=0;
if(cout<<c<<endl)
c++;
cout<<c<<endl;
return 0;
}
Here If condition becomes true as
cout<<c<<endl
return 1 because of that value of variable c
increase by 1. Same thing can be done in C programming , just use printf
in if condition.#include <stdio.h>
int main()
{
int c=0;
if(printf("Hello World!\n"))
c++;
printf("%d",c);
return 0;
}
No comments:
Post a Comment