Solve if u can!!
Any type of programming problem put here and get many solutions from many CE..
Replies
-
Aviskar#include
#include
void main()
{
clrscr();
int a=10;
if(a=30)
printf("First");
else
printf("Second");
getch();
}
what will be the output?? -
Neeraj SharmaI think it would be better if people create separate threads for their own problems. That will be clutter free as when number of pages increase, people care less about seeing the older posts
-
Neeraj Sharma
Output will beAviskar#include
#include
void main()
{
clrscr();
int a=10;
if(a=30)
printf("First");
else
printf("Second");
getch();
}
what will be the output??
First
as you are not comparing the expression in if so it will always evaluate to true and if part is executed -
Aviskar#include
#include
void main()
{
clrscr();
int a=10;
if(a==10);
printf("First");
else
printf("Second");
getch();
}
what will be the output?? -
Neeraj Sharma
If this program is saved as .C extension then it wont work as in C the declarations must always precede clrscr().Aviskar#include
#include
void main()
{
clrscr();
int a=10;
if(a==10);
printf("First");
else
printf("Second");
getch();
}
what will be the output??
If this program is saved as .CPP extension then the output will be First -
amitabh1608second
-
Neeraj SharmaOops yeah second is the output if the program is saved with .cpp extension. I didn't notice the semicolon after if. my bad 😛
-
amitabh1608garbage value....even 1 if u r using different compilers.
-
nareshkumar6539
Even if you saved as.CPP extension also it will give error as MISPLACED ELSE(else without if)Nick_SharmaIf this program is saved as .C extension then it wont work as in C the declarations must always precede clrscr().
If this program is saved as .CPP extension then the output will be First
You are reading an archived discussion.
Related Posts
Asus is all set to turn everyone’s eyes to their products at Computex 2012. And it has become quite successful in building up the heat for the same with its...
Hello everyone, my name is Vasu Nagpal and i have done my B.tech from Rajasthan Technical University,Kota.
I have recently completed my B.tech and now i am a confused engineer...
I have recently completed my B.tech last month and now i can hardly find any job in my core profile i.e.electronics and communication.
I have done a specialisation course in...
I'm Amr Nabil i love mechanical engineering specially automotive engineering
I'm quiet impressed by engines and i would like to learn everything about it.