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
Explain what are run-time errors?
How can I find out how much free space is available on disk?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
Explain what is meant by 'bit masking'?
What is a ternary operator in c?
What is c variable?
Explain the properties of union. What is the size of a union variable
Is the exit() function same as the return statement? Explain.
What does sizeof return c?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What should malloc(0) do?
Define VARIABLE?
Give basis knowledge of web designing ...
Write a program to know whether the input number is an armstrong number.