You are on page 1of 5

start

Flowchart Loop Structure: 1 to


continue

decorations
num

choice

output "Enter 1 to
continue:"

input choice

choice = 1?
output "Enter
1 to continue
input choice

Stop

Source Code
#include <iostream.h>
#include <conio.h>

int main() {
int choice;

clrscr();

cout << "Enter 1 to continue: ";


cin >> choice;

while ( choice == 1) {
cout << "Enter 1 to continue: ";
cin >> choice;
}
getch ();
return 0;
}

start

Flowchart Loop
Structure : Non-zero
Non-negative integer

decorations
num limit
num choice
output "Enter non-zero
non-negative integer:"

input limit

counter <=

output counter, " "

input = counter
+1

Stop

Source Code
#include <iostream.h>
#include <conio.h>

int main() {
int limit;

clrscr();

cout << "Enter non-zero non-negative integer: ";


cin >> limit;

for ( int counter = 1; counter <= limit; counter ++) {


cout << counter << " ";
}
getch ();
return 0;
}

Screen Output

You might also like