1. For
1_Sumar 20 numeros
#include <iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int main (){
int num,control;
num=1;
for(int control=1;control<=20;control++);
{
cout<<control<<endl;
}
getch();
return 0;
}
3. Dos números ------------------------------------for
#include <iostream>
#include<stdlib.h>
#include<string>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int main(){
int control,num1;
for(control=1;control<=10;control++)
{
cout<<"num1"<<endl;
num1=num1+2;
}
system("pause");
return 0;
}
4. Tablas de multiplicar -----------------------------for
#include <iostream>
#include<stdlib.h>
#include<string>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input
loop */
int main(){
int control,numero,resultado;
control=1;
numero=1;
do
{
resultado=control*numero;
cout<<numero<<"*"<<control<<"="<<resultado<<endl;
control++;
}
while(control<=10);
system("pause");
return 0;
}
5. Números pares -----------------------------for
#include <iostream>
#include<stdlib.h>
#include<string>
using namespace std;
int main()
{
int num,control,n;
n=0;
for(control=1;control<=10;control++)
{
cout<<n<<endl;
n=n+2;
}
system("pause");
return 0;
}