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 |
What is floating point constants?
post new interiew question and aptitude test papers
write a c program to find the roots of a quadratic equation ax2 + bx + c = 0
11 Answers CSC, St Marys, TATA,
WHAT IS HIGH LEVEL LANGUAGE?
What is nested structure?
Can u please send me the exam pattern and also Previous papers to javed123go@gmail.com
Is c++ based on c?
write the output of following code .. main() { static int a[]={10,20,30,40,50}; int *ptr=a; static int arr[2][2]={1,2,3,4}; char str[]="ABCD * 4#"; char *s=str+2; int i,j; for(i=0;i<5,i++) printf("%d",*ptr++); for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d\n",*(*(n+i)+j)); printf("%c\n%c\n%c\n",*(str+2),*s++,*--s); }
where do we use volatile keyword?
what is the difference between normal variables and pointer variables..............
15 Answers HP, Infosys, Satyam, Vivekanand Education Society,
Explain spaghetti programming?
program to print upper & lower triangle of a matrix