Cout << “List” << endl; // WSQ07

--Originally published at Alvaro_246

“List”

En esta tarea hice un programa que le pidiera al usuario 10 números y realizara las siguientes funciones

10

Este programa tiene 3 funciones:

1- La “sumatoria”de los números:

float Sumatoria(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float Rsum;
Rsum = (a + b + c + d + e + f + g + h + i + j);
return Rsum; 

2- El “promedio “de los 10 números:

float Promedio(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float Rprom;
Rprom = ((a + b + c + d + e + f + g + h + i + j)/10);
return Rprom;

3- Por ultimo y más complicado la “Desviación estándar” entre los 10 números:

float Varianza(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float Rvari, Pizza, Total, DesvSTD;
Total = (a + b + c + d + e + f + g + h + i + j);
Pizza = Total/10;
Rvari = pow(a-Pizza,2)+pow(b-Pizza,2)+pow(c-Pizza,2)+pow(d-Pizza,2)+pow(e-Pizza,2)+pow(f-Pizza,2)+pow(g-Pizza,2)+pow(h-Pizza,2)+pow(i-Pizza,2)+pow(j-Pizza,2);
DesvSTD = sqrt(Rvari/10);
return DesvSTD;

Código y Resultados:

Codigo LISTResultados1Resultados 2


int Square & Cube Root // Quiz Week 03

--Originally published at Alvaro_246

Quiz 03

In this Quiz I made a program to calculate de square root and cube root of a especific number, I worked with math funtions, I used the library <cmath> beacuse I need to use Math operations the funtion are “sqrt and cbrt” and one “if” because the program don’t calculate negative numbers (-x) and the program prints “Error, Don’t use negative numbers”

quiz3

This is my Code :

#include <iostream>
#include <cmath>

using namespace std;
double square_root (double x) {
double square_root = sqrt(x);
return square_root;
}
double cube_root(double x) {
double cube_root = cbrt(x);
return cube_root;
}
double x;
int main() {
cout << “This Program calculate the Square and cube root of a specific number” << endl;
cout << “Insert a number”<< endl;
cin >> x;
if (x<=0){
cout << “No negative numbers”<< endl;
}
cout <<“square root is: “<< square_root(x)<<endl;
cout <<“cube root is : ” << cube_root(x)<< endl;
return 0; // Alvaro_246
}


int sumSqueres (x,y,z) // Quiz Week 04

--Originally published at Alvaro_246

Quiz04

En el Quiz de la semana #04 tuvimos un problema el cual consistía en ingresar 3 números (x,y,z) y el programa debe de imprimir el mas grande entre esos 3 números, pero esto haciéndolo como función “minimunThree (int a, int b, int c)” y en la segunda parte del quiz teníamos que elevar cada uno de estos 3 números al cuadrado y después sumar cada resultado, para esto coloque la siguiente formula “(x*x + y*y + z*z)=” dentro de la función sumSqueres(x,y,z)

2017-02-08

#include <iostream>
using namespace std;

int minimunThree(int a, int b, int c) {
if(a>=b && a>=c){
return a;}
else if (b<=a && a<=b){
return b;}
else if (c<=a && c<=b){
return c;}
}

int sumSqueres(int x, int y, int z)
{
int R;
R= (x*x+y*y+z*z);
return R;
}

int main ()
{
float x,y,z;
cout << “Este programa encuentra el numero mas grande entre x,y,z” << endl;
cout << “Inserte el valor de x” << endl;
cin >> x;
cout << “Inserte el valor de Y” << endl;
cin >> y;
cout << “Inserte el valor de Z” << endl;
cin >> z;

cout<<“El numero mayor encontrado es: “<< minimunThree(x,y,z)<< endl;
cout<<“La suma de los cuadrados de los 3 numeros es: ” <<sumSqueres(x,y,z)<< endl;
return 0;
}
//Alvaro_246