/* */ Click to Join Live Class with Shankar sir Call 9798158723
Q.) WAP to print and calculating the table of 10. using Do while loop in C program.
    #include 
int main ()
{
    int data = 10;
    int loop = 1;
    /* do while loop */
    do
    {
        printf(" data * loop =  %d\n", (data*loop));
        ++loop;
    }
    while( loop <= 10 );
    return 0;
}
Output
data * loop = 10
data * loop = 20
data * loop = 30
data * loop = 40
data * loop = 50
data * loop = 60
data * loop = 70
data * loop = 80
data * loop = 90
data * loop = 100

Program Explanation


Step 1 : Include header files (#include< stdio.h> and #include< conio.h>).

Step 2 : Start with main function with return type.

Step 3 : parenthesis to start and end the program { }.

Step 4 : declare variables with data type i.e, 'data' 'loop' is an integer type so we use "int" data type.

Step 5 : Use output function printf() to print the output on the screen.

Step 6 : Use input function scanf() to get input from the user.

Step 7 : here, we have calculating the table of 10 using Do while loop, Initialize the number , and check the condition in loop ,where the condition was true then print the table of 10 between 1 to 10.

Step 8 : using getch() function to hold the screen.