Do-while loop in C

Write a program to use the do-while loop in C.

Example:
Input:  n = 5
Output: Numbers tiil 5 are
0 1 2 3 4 5 

C Program

#include <stdio.h>

int main()
{
    int n = 5;
    printf("Numbers tiil %d are\n"n);
    int i = 0;
    do
    {
        printf("%d "i);
        i++;
    } while (i <= n);

    return 0;
}


No comments:

Post a Comment