Computer Science, asked by mmehak2358, 1 year ago

can we write a for loop without initialization? if yes then give example

Answers

Answered by Aishwarya98
1

For loop without initialization is possible when the initialization is done in the previous line itself. The program will be compiled and executed error free. Since the initialization is declared immediately after the main statement.

#include<stdio.h>

#include<conio.h>

int main()

{

int i=0,n;

scanf("%d",&n);

for(;i<n;i++)

{

printf("%d",i);

}

return 0;

}

Similar questions