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 to create c progarm without void main()?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Name the language in which the compiler of "c" in written?
How to add two numbers with using function?
What are pointers? Why are they used?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What are the types of data files?
what is the first address that gets stored in stack according to a C or C++ compiler???? or what will be the first address that gets stored when we write a C source code????????
What is type qualifiers?
How will you write a code for accessing the length of an array without assigning it to another variable?
whether itis a structured language?