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 |
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
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
what is meant for variable not found?
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
WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }
I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.
quoroum of computer languages?
who was the present cheif governor of reserve bank of india
6 Answers State Bank Of India SBI,
What is the code for following o/p * * * * * * * * * * * * * * * *
Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .
char* f() return "hello:"; void main() {char *str=f(); }
how to convert decimal to hexadecimal without using arrays just loops