EVAP4

#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
    int i,n,suma,opcion;
    cout<<"*****MENU DE OPCIONES*****\n\n";
    cout<<"1)OPCION 1\n";
    cout<<"2)OPCION 2\n";
    cout<<"3)OPCION 3\n";
    cout<<"4)OPCION 4\n";
    cout<<"5)OPCION 5\n";
    cout<<"6)OPCION 6\n";    
    cout<<"7)OPCION 7\n";    
    cout<<"8)OPCION 8\n";
    cout<<"9)OPCION 9\n";
    cout<<"DIGITE -0- PARA SALIR\n";
    cout<<"**************************\n";
    cout<<"INGRESE UNA OPCION (1 a 9): ";cin>>opcion;cout<<endl;
    switch(opcion)
    {
                  case 1:
                       {
suma=0;
i=1;cout<<endl;
cout<<"*****CALCULO DE LOS PRIMEROS TERMINOS PARES*****";cout<<endl;
cout<<"INGRESE NUMEROS DE TERMINOS A SUMAR: ";cin>>n;cout<<endl;
for(i=1;i<=n;i++)
{
suma=suma+(2*i);
                                                        }
                                                        cout<<"LA SUMA DE LOS PRIMEROS NUMEROS PARES ES: "<<suma;cout<<endl;
                                                        break;
                       }
                  case 2:
                       {
                                                        int i,j,n;
                                                       cout<<"*********TABLA DE MULTIPLICAR*********";cout<<endl;cout<<endl;
                                                       cout<<"INGRESE NUMERO DE TABLA DE MULTIPLICAR: ";cin>>n;cout<<endl;
                                                       for(i=1;i<=j;i++)
                                                      {
cout<<endl;
                                                                cout<<"TABLA DE MULTIPLICAR";cout<<endl;cout<<endl;
                                                                for(j=1;j<=12;j++)
               {
        cout<<i<<"*"<<j<<"="<<i*j;cout<<endl;
                                                                }
                                                         }
                                                        break;
                       }
                     case 3:
                       {
cout<<"*********NUMERO MAYOR A 6*********\n\n";
int num;
cout<<"INGRESE UN NUMERO MAYOR A 6\n\n";cin>>num;cout<<endl;
if(num<=6)
{
do
{
cout<<"INGRESE UN NUMERO MAYOR A 6\n\n";cin>>num;cout<<endl;
}
while(num<=6);
}
cout<<"EL NUMERO FUE: "<<num;cout<<endl;
                            break;
                       }
                     case 4:
                       {
cout<<"*********LOS NUMEROS DEL 1 AL 20*********\n\n";
int a;
cout<<"Los numero del 2 al 20";cout<<endl;
for(a=2;a<=20;a=a+2)
{
cout<<a;cout<<endl;
}
                            break;
                       }
                     case 5:
                       {
cout<<"*********NUMEROS DE A HASTA B*********\n\n";
int Ni,Nf;
                                                int i;
                                               cout<<"NUMEROS COMPRENDIDOS EN UN DETERMINADO RANGO\n\n";
                                                 cout<<"INGRESE NUMERO INICIAL:";cin>>Ni;cout<<endl;
                                               cout<<"INGRESE NUMERO FINAL:";cin>>Nf;cout<<endl;
                                               for (i=Ni+1;i<Nf;i++)
                                                 {
cout<<-i;cout<<endl;cout<<endl;
}
break;
                       }
                     case 6:
                       {
cout<<"*********FACTORIAL DE UN NUMERO*********\n\n";
int N,i;
int f=1;
do

cout<<"INGRESE UN NUMERO:";cin>>N;cout<<endl;
}
while(N<=0);
for(i=1;i<=N;i++)
f=f*i;
cout<<"EL FACTORIAL DEL NUMERO ES:"<<f;cout<<endl;
                            break;
                       }
                     case 7:
                       {
cout<<"******* SUMA DE LOS CUADRADOS DE LOS NÚMEROS*********\n\n";
int N;
int R;
do
{
cout<<"INGRESE LA CANTIDAD DE NUMEROS:";cin>>N;cout<<endl;
}
while(N<0);
R=N*(N+1)*(2*N+1)/6;
cout<<"LA SUMA DE LOS CUADRADOS DE LOS NUMEROS ES:"<<R;cout<<endl;
                            break;
                       }
                     case 8:
                       {
cout<<"*********LA SUMA DE LOS PRIMEROS CUBOS ES*********\n\n";
suma=0;
i = 1;
cout <<"CALCULO DE LA SUMA DE LOS PRIMEROS CUBOS\n\n";
cout <<"INGRESE EL NUMERO TERMINOS A SUMAR: ";cin >>n;
cout<<endl;
for (i=1; i<=n; i++)
{
suma=suma+(i*i*i);
}
cout <<"LA SUMA DE LOS PRIMEROS CUBOS ES: "<<suma;cout<<endl;
                            break;
                       }
                     case 9:
                       {
cout <<"*******CALCULO DE LA SUMA DE LOS MULTIPLOS DE 5*******\n\n";   
cout <<"INGRESE EL NUMERO TERMINOS A SUMAR:";cin >>n;cout<<endl;
suma=0;
i = 1;
while (i<=n) 
{
suma = suma + (5*i);
i=i+1;
}
cout <<  "LA SUMA DE LOS MULTIPLOS DE 5: "<< suma;cout<<endl;
                            break;
                       }
                  cout<<"NO ES UNA OPCION";
    }
    system("pause");
}

No hay comentarios:

Publicar un comentario