1. What will be the output of the following programs.
a) #include <stdio.h>
Main()
{
Int x=4;
While(x==1)
{
X=x-1;
Printf(“%d”,x);
--x;
}
}
Answers were Sorted based on User's Feedback
Answer / rohit
variable X have not been defined. so it has an error...........
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / raja
In the following code snippet
#include <stdio.h>
Main()
{
Int x=4;
While(x==1)
{
X=x-1;
Printf(“%d”,x);
--x;
}
}
everything is fine except the typing mistake. C is a case sensitive language. So if u give Main instead of main u will get a compiler error. So Main, Int, While, Printf should be use as a main, int, while, printf and the X in line 7 should be x.
The correct program is
#include <stdio.h>
main()
{
int x=4;
while(x==1)
{
x=x-1;
printf("%d",x);
--x;
}
}
Nothing will get printed because x != 1
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / bhavani
i think x initialization wrong.so it has an error...........
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / satya
Ya.. it is correct...
you initialized the x as Int..
we have to to initialize it as int...
| Is This Answer Correct ? | 0 Yes | 0 No |
How does the C program handle segmentation faults?
What is the stack in c?
Why & is used in c?
what is the different between if-else and switch statment (other than syntax)
26 Answers CTS, Oracle, Scorpos,
write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR
Differentiate between the expression “++a” and “a++”?
Is exit(status) truly equivalent to returning the same status from main?
What is oops c?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
why u join this call center?
how to exchnage bits in a byte b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3 please mail me the code if any one know to rajeshmb4u@gmail.com
What is character set?