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 |
Differentiate between #include<...> and #include '...'
Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered
Between macros and functions,which is better to use and why?
Do you know what is a programing language ?
what is constant pointer?
What is the difference between ++a and a++?
Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….
Write a program that will read the input of any number of digits n in a row of shafh showing the breakdown of the printing and printing figures by the recursive function.
What are header files? What are their uses?
How can I change the size of the dynamically allocated array?
What do header files do?
what does keyword ‘extern’ mean in a function declaration?