-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled1.c
More file actions
30 lines (24 loc) · 1.03 KB
/
Untitled1.c
File metadata and controls
30 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
double cant1, cant2, cant3, tot, porc1, porc2 ,porc3;
int main(){
printf("Ingrese la cantidad invertida del primer socio ");
scanf("%lf",&cant1);
printf("Ingrese la cantidad invertida del segundo socio ");
scanf("%lf",&cant2);
printf("Ingrese la cantidad invertida del tercer socio ");
scanf("%lf",&cant3);
printf("Ingrese el total obtenido con la inversion ");
scanf("%lf",&tot);
//acontinuacion convierto la cantidad ingresada en el porcentaje de el tototal del dinero invertido
porc1=cant1*100/(cant1+cant2+cant3);
porc2=cant2*100/(cant1+cant2+cant3);
porc3=cant3*100/(cant1+cant2+cant3);
//acontinuacion imprimo la cantidad correspondiente a cada socio
printf("\nLa parte del segundo socio es: %.2lf",(porc1*tot)/100);
printf("\nLa parte del primer socio es: %.2lf",(porc2*tot)/100);
printf("\nLa parte del tercer socio es: %.2lf",(porc3*tot)/100);
printf("\nPresione cualquier tecla para salir...");
getch();
}