What is the output of the following
int main()
{
int i=0;
for(;i<=9;)
{
i++;
printf("%d",i);
}
return 0;
}
here output is
12345678910
int main()
{
int i=0,j=0;
while(i<4,j<5)
{
i++;
j++;
}
printf("%d, %d\n",i,j);
return 0;
}
#Output: 5, 5
int main()
{
int n,i;
unsigned long long result=1;
printf("Enter an integer : ");
scanf("%d",&n);
for(i=1;i<=n;++i)
{
result*=i;
}
printf("The output of the program is %llu",result);
return 0;
}
#Output: Factorial of n
int main()
{
switch(printf("Govt. College of Engg. "))
{
default:
printf("Jalgaon");
break;
case 1:
printf("Aurangabad");
break;
case 2:
printf("Pune");
break;
case 3:
printf("Amravati");
break;
}
return 0;
}
#Output: Govt. College of Engg. Jalgaon
int main()
{
if((0 && 1)||(1 && -1))
printf("Condition is True.");
else
printf("Condition is False.");
return 0;
}
#Output: Condition is True.
int main()
{
int i=1;
while(i<=5)
{
if(i==3)
break;
printf("%d",i);
i++;
}
return 0;
}
#Output: 1 2
int main()
{
char x=0;
for(x=0;x<=127;x++)
{
printf("%d",x);
}
return 0;
}
#Output: 0, 1, 2, …….., 127, -128, -127,……., -2, -1, 0, 1, ……. infinite loop
int main()
{
int i=0;
do
{
printf("While Vs do-while\n");
}while(i==0);
printf("Out of Loop");
return 0;
}
#Output: ‘while vs do-while’ infinite times