by Dinesh Thakur Category: Control Structures

In this example, the initial value of loop variable j (of type int) is 100 and the update expression (j -= 10) reduces it by 10 after each iteration of the for loop.

 

The printf statement is executed as long as the value of j is greater than or equal to zero. Thus, j assumes values as 100, 90, ... , 0. These values are printed using a printf statement as shown below.

#include <stdio.h>

void main()

{

        int j;

        clrscr();

        printf("Print integer number from 100 to 0 in steps of -10 :\n");

        for (j = 100; j >= 0; j -= 10)

             {

             printf("%d ", j);

             }

            getch();

}

     C Program for Print integer number from 100 to 0 in steps of -10



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles