Jan 25, 2022

'For' and 'while' Loops (C Language)

Use of for loop and while loop 

 #include<stdio.h>
int main()
{
    //using for loop
    printf("Using for loop :\n");
    for (int  i = -1; i > -15; i--)
    {
        printf("%d\n", i);
    }

    //using while loop
    printf("Using while loop :\n");
    int i = -1;
    while (i>=-14)
    {
        printf("%d\n", i);
        i--;
    }
   
   
    return 0;
}

No comments:

Post a Comment

Comparing two files in C language.

Operations on More than one File.    # include < stdio.h > # include < stdlib.h > # include < string.h > int main ( int ...