Display the first 10 mutiples of 17 using: a) DO WHILE b) DO UNTIL C) FOR .. NEXT
Answers
Answer:
mark me as brainliest
Explanation:
do… while loop
Syntax:
1
2
3
4
5
do{
// body of do while loop
statement 1;
statement 2;
}while(condition);
In do while loop first the statements in the body are executed then the condition is checked. If the condition is true then once again statements in the body are executed. This process keeps repeating until the condition becomes false. As usual, if the body of do while loop contains only one statement, then braces ({}) can be omitted. Notice that unlike the while loop, in do while a semicolon(;) is placed after the condition.
The do while loop differs significantly from the while loop because in do while loop statements in the body are executed at least once even if the condition is false. In the case of while loop the condition is checked first and if it true only then the statements in the body of the loop are executed.
The following program print numbers between 1 and 100 which are multiple of 3 using the do while loop:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h> // include the stdio.h
int main()
{
int i = 1; // declare and initialize i to 1
do
{
// check whether i is multiple of 3 not or not
if(i % 3 == 0)
{
printf("%d ", i); // print the value of i
}
i++; // increment i by 1