EVAP4

#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
    int i,n,suma,opcion;
    cout<<"-----MENU-----\n\n";
    cout<<"1)CANTIDAD DE NUMEROS PARES E IMPARES\n";
    cout<<"2)CALCULO DE LA SUMA DE LOS MULTIPLOS DE 15\n";
    cout<<"3)TABLA DE MULTIPLICAR\n";
    cout<<"4)FACTORIAL DE UN NUMERO\n";
    cout<<"5)NUMEROS DE A HASTA B\n";
    cout<<"6)CALCULO DE LOS PRIMEROS TERMINOS PARES\n";  
    cout<<"7)LOS NUMEROS DEL 2 AL 20\n";  
cout<<"8)LA SUMA DE LOS PRIMEROS CUBOS ES\n";
    cout<<"9)NUMERO MAYOR A 100\n";
    cout<<"DIGITE -0- PARA SALIR\n";
    cout<<"**************************\n";
    cout<<"INGRESE UNA OPCION: ";
cin>>opcion;
cout<<endl;
    switch(opcion)
    {
case 1:
        {
int N;
       int P=0;
                int I=0;
       cout<<"CANTIDAD DE NUMEROS PARES E IMPARES\n\n";
       cout<<"INGRESE UN NUMERO: ";cin>>N;cout<<endl;
       cout<<"Numero <0> acaba el conteo\n";cout<<endl;
                if(N%2==0)
       P=P+1;
               else
       I=I+1;
               while (N>0)
               {
           cout<<"INGRESE UN NUMERO: ";cin>>N;cout<<endl;
           if(N%2==0)
           P=P+1;
                   else
                    I=I+1;
}
                 cout<<"LA CANTIDAD DE NUMEROS PARES ES: "<<P;cout<<endl;
                 cout<<"LA CANTIDAD DE NUMEROS IMPARES ES: "<<I;cout<<endl;
                break;
        }
        case 2:
        {
            cout <<"CALCULO DE LA SUMA DE LOS MULTIPLOS DE 15\n\n";
cout <<"INGRESE EL NUMERO TERMINOS A SUMAR:";
cin >>n;
cout<<endl;
suma=0;
i = 1;
while (i<=n)
{
suma = suma + (15*i);
i=i+1;
}
cout<<"LA SUMA DE LOS MULTIPLOS DE 15: "<<suma;
cout<<endl;
            break;
        }
        case 3:
        {
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 4:
        {
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 5:
        {
cout<<"NUMEROS DE A HASTA B\n\n";
int Ni,Nf;
       int i;
       cout<<"NUMEROS COMPRENDIDOS EN UN 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:
        {
suma=0;
i=1;cout<<endl;
cout<<"CALCULO DE LOS PRIMEROS TERMINOS PARES\n\n";
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 NUMEROS PARES ES: "<<suma;
cout<<endl;
            break;
        }
        case 7:
        {
cout<<"LOS NUMEROS DEL 2 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 8:
        {
cout<<"LA SUMA DE LOS PRIMEROS CUBOS ES\n\n";
suma=0;
i = 1;
cout<<"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<<"NUMERO MAYOR A 100\n\n";
   int num;
cout<<"INGRESE UN NUMERO MAYOR A 6\n\n";
cin>>num;
cout<<endl;
if(num<=100)
{
do
{
cout<<"INGRESE UN NUMERO MAYOR A 6\n\n";
cin>>num;
cout<<endl;
}
while(num<=100);
}
   cout<<"EL NUMERO FUE: "<<num;cout<<endl;
            break;
        }
        cout<<"NO ES UNA OPCION";
    }
    system("pause");
}
            

No hay comentarios:

Publicar un comentario