main()
{
char c;
for(c='A';c<='Z';c++)
getch();
}
Answers were Sorted based on User's Feedback
The initial condition is c='A'.
Here the the statement "getch();" is the body of the loop.
it is executed once and c becomes 'B' and again the loop is
executed.
This is done,I mean the loop is executed 26 times.
when c become 'Z' the loop is executed one more time(because
the condition is c<='Z')and then the program exit.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / vignesh1988i
this wont show any errors since syntactically it is correct...
but since there is no instructions after for loop for operations unfortunelety getch() will be taken as the next instruction , and thus compiler system will be under ambiquity. since the character key pressed will be taken as the value of getch() so that will say to the OPERATING SYSTEM that compilation has got over and it will return to the IDE... but for loop has not got over.. so this depends on the compilers usage............
thank u
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / aaaaaaa
No Errors
loop will execute for 26 times,each time it will wait for an
input and finally terminate when c becomes > Z.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sambath
Answer : "It have no errors but it will be still running
mode until use cntrl+break.. using { and } we will avoid this."
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / abhishek rajput
Since A=65 and Z=90.
So each time getch will
encounter and user
need to press anykey
each time till c
increments to 90...
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / carlos
God help those who help themselves!
try it ur's self because i don't know about this programming
brother! i'm sorry forgive me.
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / bharghavi
if ther s no body for the 'for' loop,it should end with
semicolon..(i.e)
main()
{
char c;
for(c='A';c<='Z';c++);
getch();
}
or
main()
{
char c;
for(c='A';c<='Z';c++)
{}
getch();
}
Is This Answer Correct ? | 6 Yes | 11 No |
when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
Write a c-programe that input one number of four digits and find digits sum?
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.
Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
What is the out put of this programme? int a,b,c,d; printf("Enter Number!\n"); scanf("%d",&a); while(a=!0) { printf("Enter numbers/n"); scanf("%d%d%d",&b,&c,&d); a=a*b*c*d; } printf("thanks!"); getche(); Entering numbers are a=1,b=2,c=3,d=4 b=3,c=4,d=-5 b=3,c=4,d=0
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10