Está en la página 1de 3

Carlos Javier Alvarado Enciso --UVM -- Ing. Sistemas Computacionales 2do Semestre.

Nombre del estudiante: Carlos Javier Alvarado Enciso

Nombre del trabajo: ALGORITMOS

Fecha de entrega: 12-Abril-2013

Campus: San Rafael

Carrera /Prepa: Ing. En Sistemas Computacionales

Semestre/Cuatrimestre: 2do Semestre

Nombre del maestro: Rafael Velsquez

Carlos Javier Alvarado Enciso --UVM -- Ing. Sistemas Computacionales 2do Semestre. PRIMER ALGORITMO DADOS DOS NUMEROS DECIR CUAL ES MAYOR// NUMERO MAYOR.cpp: define el punto de entrada de la aplicacin de consola. // #include "stdafx.h" #include "conio.h" #include "stdio.h"

int _tmain(int argc, _TCHAR* argv[]) { int A,B; printf("Insertar el valor de A"); scanf_s("%i",&A); printf("Insertar el valor de B"); scanf_s("%i",&B); if (A==B) {printf ("%i es igual a %i", A,B); } else { if (A>B) { printf("%i es mayor que %i", A,B); } else { printf("%i no es mayor que %i", A,B); } } _getch(); return 0; }

Carlos Javier Alvarado Enciso --UVM -- Ing. Sistemas Computacionales 2do Semestre. SEGUNDO ALGORITMO- ESCRIBIR UN NOMBRE Y CENTRARLO#include"iostream" #include"string.h" #include"stdio.h" #include"conio.h" using namespace std; int main() { char str[100]; cout << "Digita tu Nombre :D!!!!"; cin.getline(str, 100, '\n'); int numofch = strlen(str); for(int i=1; i<(40-(numofch/2)); i++) cout << " "; cout << str; cin.get(); }

TERCER ALGORITMO- FACTORIAL DE UN NUMERO#include "stdafx.h" #include "iostream" #include "stdlib.h" #include "conio.h" using namespace std; float factorial=1,n,i; int main() { cout<<"Digita un numero chico :3\n\n"; cin>>n; for (i=n;i;i--) {factorial*=i; } cout<<n<<"<---- El factorial de ese numero es :) ---> = "<<factorial; _getch(); }

También podría gustarte