Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num1 = 1; // declaring two variables as integers
- int counter = 1;
- while (counter <= 100) // loop will continue to run while counter is below 100
- {
- if (num1 % 5 == 0) // this will check if a number is a multiple of 5 by checking whether or not the modulus is 0
- {
- cout << num1 << endl;
- num1++; //these three lines will if the number is a multiple of 5 it will be shown on the screen and then a new line will be started as well as increasing the variables by 1
- counter++;
- }
- else
- {
- num1++; // theses two lines will increas the variables by 1 everytime they occur
- counter++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement