Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
I want output of the program with suitable logic
–3
votes
asked
Apr 5, 2020
by
Rajeev Kumar
(
90
points)
int main()
{
char i;
if(i=0,1,2)
printf("Hello");
else
printf("Programmin in C");
printf("%c",i);
printf("World");
return 0;
}
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
2 Answers
+1
vote
answered
Apr 6, 2020
by
Nandan
(
170
points)
you have to used OR operator (||) in the if condition like:-
if(i=0||i=1||i=2)
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Apr 6, 2020
by
1916114
(
260
points)
At first you didnt take the input from the keyboard ,whatever the value that i have initially thre programme runs on that ,i.e. asskey value,first initate to some other known value and in the code take input from the keyboard
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...