Use a while loop to display all multiples of 13 lower than 500. - C++ Statement

C++ examples for Statement:while

Description

Use a while loop to display all multiples of 13 lower than 500.

Demo Code

#include <iostream> 

int main() /*from  w  w  w . ja  v a 2 s.c om*/
{ 
    int counter = 0; 
   
    while (counter < 500) 
    { 
           counter++; 
           if (counter % 13 == 0) 
            { 
                std::cout << counter << " "; 
            } 
    } 

    std::cout << "\n"; 
    return 0; 
}

Result


Related Tutorials