there is two conditions ,

1. while using for loop for printing 1 to 50 no's simulteneous
2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables

who will take more time for compiling and execution?
explain in details with reason?



there is two conditions , 1. while using for loop for printing 1 to 50 no's simulteneous 2...

Answer / avanish pal

For loop will take more time for compiling and execution
because when we execute the program, flow of control frist
print 1 and after that returns to the condition and than
printed 2 this process repeated 50 times where as in simple
printf it straight print all numbers.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

Describe for loop and write a c program to sum the series X + x2/2! + x3 /3! + …….. up to fifteen terms.

2 Answers  


21. #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

3 Answers  


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

0 Answers  


Why main is used in c?

0 Answers  


What is the difference between struct and typedef struct in c?

0 Answers  






The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

0 Answers  


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

0 Answers  


Diff between for loop and while loop?

2 Answers   TCS,


While(1) { } when this loop get terminate is it a infinite loop?

5 Answers  


#include<stdio.h> #include<conio.h> int main() { int a[4][4]={{5,7,5,9}, {4,6,3,1}, {2,9,0,6}}; int *p; int (*q)[4]; p=(int*)a; q=a; printf("\n%u%u",p,q); p++; q++; printf("\n%u%u",p,q); getch(); return 0; } what is the meaning of this program?

2 Answers  


What is the use of a static variable in c?

0 Answers  


How do you initialize function pointers? Give an example?

3 Answers  


Categories