int i =10
main()
{
int i =20,n;
for(n=0;n<=i;)
{
int i=10
i++;
}
printf("%d", i);
Answers were Sorted based on User's Feedback
Answer / jai
printf() will never be executed since for() is an infinite
loop.
Is This Answer Correct ? | 30 Yes | 2 No |
Answer / vignesh1988i
it will not print i value at all , since the loop is always
true for all cases. since the termination condition is
depending upon n&i,always n<=i, what ever possibe positive
value greater than zero ,it may be.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / dips
it doesnt have any terminating condition so it will be
infinite loop ,no output
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / guest
the print would be 20.
the problem is about scope. the first i=10 is global scope.
But inside main() comes function scope. So i=20. The i
inside the for loop is of block scope and does not affect
the i outside it.
Is This Answer Correct ? | 5 Yes | 9 No |
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!
What is the difference between array and pointer in c?
What are the primitive data types in c?
print ur name without using any semicolon in c/c++....
21 Answers Bosch, TCS, Wipro,
What are external variables in c?
main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }
write a progam to compare the string using switch case?
How can you check to see whether a symbol is defined?
#include<stdio.h> int main() { int i=0,j=1,k=2,m,n=0; m=i++&&j++&&k++||n++; printf("%d,%d,%d,%d,%d",i,j,k,m,n); }
12 Answers Capital IQ, Sasken,
What is chain pointer in c?