Leave one or more expressions blank but don't omit the semicolons in for loop - C Statement

C examples for Statement:for

Description

Leave one or more expressions blank but don't omit the semicolons in for loop

Demo Code

#include <stdio.h>
int main(void)
{
    int ans, n;//from  w  ww  .j  ava  2s  . c o  m
    
    ans = 2;
    for (n = 3; ans <= 25; )
        ans = ans * n;
    printf("n = %d; ans = %d.\n", n, ans);
    return 0;
}

Result


Related Tutorials