Sie sind auf Seite 1von 4

Alumno: Luis Eduardo Mosquera Asprilla

Quinto semestre

INGENIERIA DE SISTEMAS

Corporación tecnológica industrial colombiana


Traer los siguientes ejercicios programados en C++

1. Promediar notas
#include <iostream.h>

# include <conio.h>

Int a,b,c,suma,promedio

Main()

Cllrscr();

Count<<”DIGITE UN NUMERO: “;

cin>>a;

Count<<”DIGITE UN NUMERO: “;

CIN>>b;

Count<<”DIGITE UN NUMERO: “;

cin>>c;

suma=a+b+c;

promedio=(a+b+c)/3;

count<<”\n LA SUMA TOTAL ES: “<<suma;

count<<”\n EL PROMEDIO ES: “ <<PROMEDIO;

getch();

}
2. Sacar los números primos
#include<stdio.h>

#include<conio.h>

Main() {

Int num,x,cont=0;

For (num=2;num<=30;num++)

For (x=2;x<=num;x++)

If (num%x==0)

Cont++;

Printf (“%d-“,num);

Cont=0;

Getch() ;

}
3. sacar los factoriales

#include <iostream>

Using namespace std;

Int main ()

//FACTORIAL DE UN NUMERO

Count<<”Digite un numero :”;

Cin<<num;

Fac=num;

For (int i=num-1; i>=1; i--) {

Fac=fac*i;

Cout<<”El factorial de “<<num<<” es “<<fac<<”\n”;

System (“PAUSE”);

RETURN 0;

Das könnte Ihnen auch gefallen