C program to print 1 to 20 using exit control loop

Program:

#include<stdio.h>

#include<conio.h>


void main()

{

    int i=1;

    clrscr();

    do

    {

        printf("%d\n",i);

        i++;

    }

    while(i<=20);

    getch();

}


Output:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

Comments

Post a Comment

Popular posts from this blog

C program to read and display book information using structure

Count positive, negative and zero values in an array

Maximum value from array