void main()
{
for(int i=0;i<5;i++);
printf("%d",i);
}
What is the output?..
Answers were Sorted based on User's Feedback
Answer / vera
012345
not
0
1
2
3
4
cz their is no printf("\n");
first time i=0 it print 0
scnd time i=1 it print 1
last time i=4 it print 4
but not 5 cz when i=5 :i is not <5
so it will not print 5
10x
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / sanjeevi
Guys remember things
1) we cant declare loop variable inside for
2) here i is local to for loop alone..
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / chuimaya
It gives an error coz we cannot declare a variable inside the for loop.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ramveer
for the first loop i is 0 so 0 is printed
for 2nd time i++ i becomes 1 so 1 is printed
for 3rd time i becomes 2 so 2 gets printed
for 4th time i becomes 3 so it gets prited
for 5th time i becomes 4 so it gets printed
now for this time i has became 5 and this isn't in loop boudary as the condition is i<5 so its breaks out of loop.
so the ans is "0 1 2 3 4" .
| Is This Answer Correct ? | 9 Yes | 10 No |
Answer / erdem
Ofcourse
01234
(logic for start from 0 to 4 and no blank or tab)
| Is This Answer Correct ? | 1 Yes | 2 No |
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
A sample program using data structure? what is file handling?
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }
who was the present cheif governor of reserve bank of india
6 Answers State Bank Of India SBI,
main() { char c; for(c='A';c<='Z';c++) getch(); }
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?
I'm having trouble with coming up with the correct code. Thank You!! The assignment was to write a program using string functions that accepts a price of an item and displays its coded value. The base of the keys: X C O M P U T E R S 0 1 2 3 4 5 6 7 8 9 Sample I/O Dialogue: Enter Price: 489.50 Coded Value: PRS.UX
what is syntax error?
void main() { int i=5; printf("%d",i+++++i); }
How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis