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;
}
}
Answer Posted / 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 |
Post New Answer View All Answers
Difference between Function to pointer and pointer to function
Why & is used in c?
How do I round numbers?
Explain what are linked list?
What is meant by operator precedence?
What is line in c preprocessor?
What does %2f mean in c?
Suggesting that there can be 62 seconds in a minute?
How is a structure member accessed?
How many loops are there in c?
Define VARIABLE?
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
What are categories used for in c?
Explain what does the format %10.2 mean when included in a printf statement?
What is the maximum length of an identifier?