- Program to Print even odd number without using if-else statement using switch case:
#include<stdio.h>
int main()
{
int no;
printf("enter the no\n");
scanf("%d",&no);
switch(no%2)
{
case 0: printf("no is even");
break;
case 1: printf("no is odd");
}
}
Output:
....................................................................
- Print welcome without using semicolons:
- Using if-statement:
Using C:
#include<stdio.h>
void main()
{
if(printf("welcome"))
{}
}
Using C++:
#include<iostream.h>
void main()
{
if(cout<<"welcome")
{}
}
- Using while loop:
#include<stdio.h>
void main()
{
while(!printf("welcome"))
{}
}
- Using switch case:
#include<stdio.h>
void main()
{
switch(printf("welcome"))
{}
}
Output:
No comments:
Post a Comment
If you have any doubts, please discuss here...👇