Está en la página 1de 4

/*ENUNCIADO: disear un algoritmo que permita imprimir la tabla de n-numeros validar que numero este entre 1 y 100.

el usuario continua con el ingreso de datos hasta que no desee ingresar mas numeros ARCHIVO: PSEUD_25 */ #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <math.h> #include <ctype.h> #include <string.h> #include <time.h> #include <iostream.h> #include <iomanip.h> #define TRUE 1 #define FALSE 0 #define MIN 0 #define MAX 100 typedef char * String; void main(){ // VARIABLES LOCALES String ENTER="\n"; int Num,cont; char op; op='s'; // CODIFICACION DEL ALGORITMO system("cls"); while((op=='s')||(op=='S')){ do{ system("cls"); cout<<"Ingrese un numero?\t"; cin>> Num; if ((!((Num>=MIN)&&(Num<=MAX)))){ cout<<"ERROR!!!\n"<<endl; } else break; }while(TRUE); cont=1; cout<<"la tabla del " <<Num <<"es \n"; while(cont<=10){

cout<<Num<< "*"<<cont<<"="<<Num*cont<<"\n"; cont=cont+1; } do{ cout<<"\n\n desea continuar (s/n)???\t"<<ENTER; cin>>op; if(((!(op=='s')||(op=='S')||(op=='n')||(op=='N')))){ cout <<"ERROR !!!!\n"<<endl; system("pause"); } else break; }while(TRUE); } system("pause"); } // FIN MAIN /*ENUNCIADO: Disear un algoritmo que me permita calcular el factorial de un numero en forma ascendente . validar el siguiente rango 0<=N<=10 ARCHIVO: PSEUD_0 */ #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <math.h> #include <ctype.h> #include <string.h> #include <time.h> #include <iostream.h> #include <iomanip.h> #define TRUE 1 #define FALSE 0 #define MIN 0 #define MAX 10 typedef char * String; void main(){ // VARIABLES LOCALES String ENTER="\n"; int N,aux,fact,cont;

// CODIFICACION DEL ALGORITMO

system("cls"); do{ system("cls"); cout<<"Ingrese un numero?\t"; cin>> N; if ((!((N>=MIN)&&(N<=MAX)))){ cout<<"ERROR!!!\n"<<endl; } else break; }while(TRUE); aux=N; fact=1; cont=1; while(cont<=aux){ fact=fact*cont; cont=cont+1; } cout<<"El factorial de " << N << " es " << fact <<ENTER; system("pause"); } // FIN MAIN /*ENUNCIADO: Disear un algoritmo utilizando el bucle mientras para invertir un numero entre 1 y 1000000 ARCHIVO: PSEUD_21 */ #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <math.h> #include <ctype.h> #include <string.h> #include <time.h> #include <iostream.h> #include <iomanip.h> #define TRUE 1 #define FALSE 0 #define MIN 0 #define MAX 1000000 typedef char * String;

void main(){ // VARIABLES LOCALES String ENTER="\n"; int num,aux,cont,inv,r;

// CODIFICACION DEL ALGORITMO system("cls"); do{ system("cls"); cout<<"Ingrese un numero?\t"; cin>> num; if ((!((num>=MIN)&&(num<=MAX)))){ cout<<"ERROR!!!\n"<<endl; } else break; }while(TRUE); aux=num; cont=0; inv=0; while(aux!=0){ r=aux%10; aux=aux/10; inv=(inv*10)+r; } cout<<"el numero invertido de " << num << " es " << inv << "\n"; system("pause"); } // FIN MAIN

También podría gustarte