0

How many times will I be printed?

#include<stdio.h> int i; for (i=1;i <=5;printf ("%d",i)); i++;

2/14/2020 4:15:53 PM

Learner Laxmi

4 Answers

New Answer

+2

infinite times. this----> for (i=1;i <=5;printf ("%d",i)); prints i (which is 1) infinite times, because i++ is not executed. If you see right of the last parenthesis of for loop is a ";" which stops there the execution . Thus i++ is never executed. It is outside of the for loop.

+2

You can use the tags to include language specification instead of asking "anyone please explain". Tags are used by search engine to find threads under similar topics by matching the search terms against thread tags. Use of irrelevant words in tags will lessen the searchability of the thread.

+2

I was bit confused previous regarding the tags but now I am clear

+1

You can edit the tags now also.. Infinite loop with ; at end. But if you remove ; then, 2 to 6 printed.