Escolar Documentos
Profissional Documentos
Cultura Documentos
1) While
Visualg
C
While (teste)
{
-
-
-
}
main() {
Cout<<i;
i=i+1
#include<iostream>
main(){
int i=1;
while(i<=1000){
cout<<i;
i++
2) Do...while
VISUALG
Repita
-
-
-
Ate teste
do{
-
-
-
}while(teste);
Ex:
#include<iostream>
using namespace std;
main(){
int i=1;
do{
cout<<i;
++i;
}while(i<=1000
3) FOR
VISUALG
fimpara
For(area1;área_teste;rea3)
Ex1:
#include<iostream>
main(){
int i;
for(i=1; i<=1000;i++){
cout<<i;
}
Ex2:
#include<iostream>
main(){
int i;
for(;i<=100;){
cout<<1;
i++;
Ex3:
#include<iostream>
main(){
int a,b;
for(a=1,b=1;a+b<=100;a++,b++)
Cout<<a+b;
Ex4:
#include<iostream>
main(){
for(; ;){
cout<<”loop infinito;”;
}
Ex5:
Main(){
For(; ;);