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
How can I automatically locate a programs configuration files in the same directory as the executable?
What is a pointer value and address in c?
What are the types of type specifiers?
What is sizeof array in c?
Why enum is used in c?
What is the purpose of sprintf?
What is the advantage of c?
What are data structures in c and how to use them?
Define the scope of static variables.
what are non standard function in c
What is difference between stdio h and conio h?
What language is windows 1.0 written?
What are lookup tables in c?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;