martes, 3 de diciembre de 2013

EVAP4

#include<iostream>
#include<windows.h>
using namespace std;

int main()
{
    int  i, n, suma, opcion;
   {
     cout <<" MENU\n\n";
     cout<<"1) SUMA DE LOS PRIMEROS MULTIPLOS DE 3  \n";
     cout<<"2) SUMA DE LOS PRIMEROS NUMEROS IMPARES  \n";
     cout<<"3) SUMA DE LOS PRIMEROS CUADRADOS \n";
     cout<<"4) FACTORIAL DE UN NUMERO  \n";
     cout<<"5) TABLA DE MULTIPLICAR \n";
     cout<<"6) NUMEROS COMPRENDIDOS EN UN RANGO \n";
     cout<<"7) CALCULO DE UNA SUMA INFINITA \n";
     cout<<"8) NUMERO MAYOR A 6  \n";
     cout<<"9)  SUMA DE LOS PRIMEROS NUMEROS AL CUBO \n";
     cout<<"10)   DIGITE  <0> PARA SALIR\n";
     cout<<"INGRESE LA OPCION : ";
cin>>opcion;
cout<<endl;

     switch(opcion)
     {
case 1:
{
suma=0;
                    i = 1;
                    cout<<endl;
                    cout <<"CALCULO DE LA SUMA DE LOS PRIMEROS MULTIPLOS DE 3";
                    cout<<endl;
                    cout <<"INGRESE EL NUMERO TERMINOS A SUMAR: ";
                    cin >>n;
                    cout<<endl;
                    for (i=1; i<=n; i++)
                    {
suma = suma + (3*i);
                    }
                    cout <<  "LA SUMA DE LOS PRIMEROS MULTIPLOS DE 3 ES: "<< suma;
                    cout<<endl;
                }
         break;
             case 2:
{
    suma=0;
                         i = 1;
                         cout<<endl;
                         cout <<"CALCULO DE LA SUMA DE NUMEROS DE LOS PRIMEROS TERMINOS IMPARES";  
                         cout<<endl;
                         cout <<"INGRESE EL NUMERO TERMINOS A SUMAR: ";
                         cin >>n;
                         cout<<endl;
                         for (i=1; i<=n; i++)
                         {
                               suma = suma + (2*i-1);
                         }
   
                         cout <<  "LA SUMA DE LOS PRIMEROS NUMEROS IMPARES ES: "<< suma;
                         cout<<endl;
}
                 break;
           case 3:
{
                    suma=0;
                    i = 1;
                    cout<<"SUMA DE LOS PRIMEROS CUADRADOS \n\n";
                    cout<<"INGRESE EL NUMERO TERMINOS A SUMAR: ";
                    cin>>n;
                    cout<<endl;
                    for (i=1; i<=n; i++)
                    {
                        suma=suma+(i*i);
                    }
                    cout <<"LA SUMA DE LOS PRIMEROS CUADRADOS ES: "<<suma;
                    cout<<endl;
                }
                 break;
            case 4:  
                {
 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:
   {
 int i,j,n;
                      cout<<"TABLA DE MULTIPLICAR";
                      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 6:
   {
int i,Ni,Nf;
                    cout<<"Ingrese Numero Inicial:";
cin>>Ni;
                    cout<<"Ingrese Numero Final:";
                    cin>>Nf;
                    for (i=Ni+1;i<Nf;i++)
                    {
                        cout<<" \a"<<endl<<i;
                        cout<<endl;
                    }
                }  
                 break;
            case 7:
{
int N,i,suma=0;
cout<<"Ingrese Denominador Final:";
cin>>N;
   for (i=1;i<=N;i++)
                    {
                      suma=suma+1/i;
                    }
                    cout<<"La Suma Es:\n"<<suma;
               }
               break;
           case 8:
{
                    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 9:
{
int n,a;
cout<<endl;
                     cout<<"ingrese el numero de terminos a sumar:";
                     cin>>n;
                     cout<<endl;
                     suma=0;
                     a=1;
                     while(a<=n)
                     {
                         suma=suma+((a*a)*a);
                         a=a+1;
                     }
                     cout<<endl;
                     cout<<"resultado de los primeros numeros al cubo:"<<suma;
                     cout<<endl;
               }
                     break;
       }            
                     
}      
system("pause");
return 0;
}