top of page

SEMANA 9

PROBLEMA 1 TABALA DE MULTIPLICACIÓN

#include <iostream>

using namespace std;

int main() {
    int opcion, n, c, SUMA, tn, ii, jj;

    do {
        cout << " M  E  N  U \n";
        cout << " -------------- \n";
        cout << " 1.- Suma de los n primeros terminos \n";
        cout << " 2.- Suma de los n primeros terminos impares \n";
        cout << " 3.- TABLA DE MULTIPLICAR \n";
        cout << " INGRESE UNA OPCION <> 0 ";
        cin >> opcion;

        switch (opcion) {
            case 1:
                cout << " 1.- Suma de los n primeros terminos \n";
                cout << endl;
                break;
            case 2:
                cout << "------------------------------------------- \n";
                cout << "1.- Suma de los n primeros terminos impares \n";
                cout << "------------------------------------------- \n";
                cout << "Ingrese el valor del n-simo termino \n ";
                cin >> n;
                c = 0;
                SUMA = 0;
                while (c < n) {
                    c++;
                    SUMA = SUMA + (2 * c - 1);
                    cout << "La suma de los " << c << " es : " << SUMA << endl;
                }
                cout << endl;
                break;
            case 3:
                cout << "\nTabla de multiplicar\n";
                cout << "Ingrese el valor hasta donde desea multiplicar: ";
                cin >> tn;
                for (ii = 1; ii <= tn; ii++) {
                    cout << "-------------------------------------\n";
                    cout << "Tabla de Multiplicar de " << ii << "\n";
                    cout << "-------------------------------------\n";
                    for (jj = 1; jj <= tn; jj++) {
                        cout << ii << "x" << jj << " = " << ii * jj << "\n";
                    }
                }
                break;
            default:
                break;
        }
    } while (opcion != 0);

    cout << "asdasd";
    return 0;
}

PROBLEMA 2
CAIDA DE TENSIÓN
USANDO FOR CON MULTIPLICACIÓN

#include <iostream>
#include <cmath>
#include <iomanip> // Para usar setprecision

using namespace std;

int main() {
    int opcion, n, c, SUMA, tn, ii, jj;
    float voltaje, resistencia, corriente;

    do {
        cout << " M  E  N  U \n";
        cout << " -------------- \n";
        cout << " 1.- Suma de los n primeros terminos \n";
        cout << " 2.- Suma de los n primeros terminos impares \n";
        cout << " 3.- TABLA DE MULTIPLICAR \n";
        cout << " 4.- Caida de tension \n";
        cout << " INGRESE UNA OPCION <> 0 ";
        cin >> opcion;

        switch (opcion) {
            case 1:
                cout << " 1.- Suma de los n primeros terminos \n";
                cout << endl;
                break;
            case 2:
                cout << "------------------------------------------- \n";
                cout << "1.- Suma de los n primeros terminos impares \n";
                cout << "------------------------------------------- \n";
                cout << "Ingrese el valor del n-simo termino \n ";
                cin >> n;
                c = 0;
                SUMA = 0;
                while (c < n) {
                    c++;
                    SUMA = SUMA + (2 * c - 1);
                    cout << "La suma de los " << c << " es : " << SUMA << endl;
                }
                cout << endl;
                break;
            case 3:
                cout << "\nTabla de multiplicar\n";
                cout << "Ingrese el valor hasta donde desea multiplicar: ";
                cin >> tn;
                for (ii = 1; ii <= tn; ii++) {
                    cout << "-------------------------------------\n";
                    cout << "Tabla de Multiplicar de " << ii << "\n";
                    cout << "-------------------------------------\n";
                    for (jj = 1; jj <= tn; jj++) {
                        cout << ii << "x" << jj << " = " << ii * jj << "\n";
                    }
                }
                break;
            case 4:
                cout << "4.- Caida de tension\n";
                float i, s, P = 0.075, L = 30, o = 0.85;

                for (i = 5; i <= 30; i += 2.5) {
                    cout << endl << "Cuando la corriente es " << i << " amperios" << endl;
                    cout << "---------------------------------- \n";
                    for (s = 2.5; s <= 20; s += 0.5) {
                        cout << "La seccion del cable es " << s << " entonces la caida de tension es " << (P * sqrt(3) * L) / (s * o) << " voltios" << endl;
                    }
                }
                break;
            
        }
    } while (opcion != 0);

    return 0;
}

image.png

PROBLEMA 3 
CAMPO MAGNETICO

#include <iostream>
#include <cmath>
#include <iomanip> // Para usar setprecision

using namespace std;

const double pi = 3.14159265358979323846;
float A, Phi, RAD1, RAD2, Xt;

int main() {
    int opcion, n, c, SUMA, tn, ii, jj;
    float voltaje, resistencia, corriente;

    do {
        cout << " M  E  N  U \n";
        cout << " -------------- \n";
        cout << " 1.- Suma de los n primeros terminos \n";
        cout << " 2.- Suma de los n primeros terminos impares \n";
        cout << " 3.- TABLA DE MULTIPLICAR \n";
        cout << " 4.- Caida de tension \n";
        cout << " 5.- RESONANCIA MAGNETICA \n";
        cout << " INGRESE UNA OPCION <> 0 ";
        cin >> opcion;

        switch (opcion) {
            case 1:
                cout << " 1.- Suma de los n primeros terminos \n";
                cout << endl;
                break;
            case 2:
                cout << "------------------------------------------- \n";
                cout << "1.- Suma de los n primeros terminos impares \n";
                cout << "------------------------------------------- \n";
                cout << "Ingrese el valor del n-simo termino \n ";
                cin >> n;
                c = 0;
                SUMA = 0;
                while (c < n) {
                    c++;
                    SUMA = SUMA + (2 * c - 1);
                    cout << "La suma de los " << c << " es : " << SUMA << endl;
                }
                cout << endl;
                break;
            case 3:
                cout << "\nTabla de multiplicar\n";
                cout << "Ingrese el valor hasta donde desea multiplicar: ";
                cin >> tn;
                for (ii = 1; ii <= tn; ii++) {
                    cout << "-------------------------------------\n";
                    cout << "Tabla de Multiplicar de " << ii << "\n";
                    cout << "-------------------------------------\n";
                    for (jj = 1; jj <= tn; jj++) {
                        cout << ii << "x" << jj << " = " << ii * jj << "\n";
                    }
                }
                break;
            case 4:
                {
               
                cout << "4.- Caida de tension\n";
                float i, s, P = 0.075, L = 30, o = 0.85;

                for (i = 5; i <= 30; i += 2.5) {
                    cout << endl << "Cuando la corriente es " << i << " amperios" << endl;
                    cout << "---------------------------------- \n";
                    for (s = 2.5; s <= 20; s += 0.5) {
                        cout << "La seccion del cable es " << s << " entonces la caida de tension es " << (P * sqrt(3) * L) / (s * o) << " voltios" << endl;
                    }
                }
               };break;
            case 5:
                {
               
                cout << "5.- Resonancia magnetica \n";
                

                cout << "Ingrese el valor del n-esimo termino: ";
                cin >> n;

                for (A = 0; A <= 2; A += 0.1) {
                    cout << endl << "AMPLITUD " << A << endl;
                    cout << "--------------------- \n";
                    for (Phi = 15; Phi <= 180; Phi += 30) {
                        RAD1 = (2 * pi * n) / 360;
                        RAD2 = (2 * pi * Phi) / 360;
                        Xt = A * cos(RAD1 * n - RAD2);
                        cout << "Cuando A= " << A << " X(" << Phi << " ) = " << Xt << endl;
                    }
                }
            }break;
               
            
        }
    } while (opcion != 0);

    return 0;
}

image.png
bottom of page