for(i=0;i=printf("Hello");i++);
printf("Hello");
how many times how will be printed?????????
Answers were Sorted based on User's Feedback
Answer / ruchi
Infinite times
i =printf("Hello");
here printf("hello") will return 5 i.e i=5 which will always
remain true that's why hello will be printed infinate times.
Is This Answer Correct ? | 23 Yes | 6 No |
Answer / vignesh1988i
here the basic thing we must understand is that :
printf(); is a function. this printf() always returns the
number of character it processes inside " ".......here it
will return 4 according to me... this will will be assigned
to i and everytime 'i' will be a non zero value always and
also a semicolon is placed after for statement , so compiler
takes that has the next line and PRINTS "HELLO" INFINITELY
since 'i' value is always non zero or always TRUE...
and there is no way for the second printf() to get printed
according to me.........
thank u
Is This Answer Correct ? | 18 Yes | 5 No |
Answer / kalyan chukka
Here in the loop it given as i=0;i=printf("Hello");
So Printf function returns how many no of charecters it
printed so it takes 5 so loop is
for (i=0;i=5;i++) so loop will be this
in the above loop first i=0 and then we assign i=5 so loop
will become for(i=5;i++) it becomes infinite loop hello
printed infineite loop.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / m.manivel
Hello will be printed infinite times and if u want to print
10 times for put i=10;(or)print for 100 times put i=100;for
user choice
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / asit mahato
for(i=0;i=printf("Hello");i++);
means
for(i=0;i=printf("Hello");i++)
{
}
thats why it will print Hello only one time.
Is This Answer Correct ? | 2 Yes | 14 No |
Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))… For example, using 99, we get the sequence 99, 99 = 81, 81 = 8. Input Format: A single integer N Output Format: A single integer which is the number of steps after which a single digit number occurs in the sequence. Sample Test Cases: Input #00: 99 Output #00: 2 Explanation: Step - 1 : 9 * 9 = 81 Step - 2 : 8 * 1 = 8 There are 2 steps to get to this single digit number. Input #01: 1137638147
What is key word in c language?
Explain about block scope in c?
What are the advantage of c language?
how to devloped c lenguege?
How can I get random integers in a certain range?
Is flag a keyword in c?
What is stack in c?
#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif
What does printf does?
How do you determine a file’s attributes?
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?