Advertisement
Guest User

Prova 2017.2

a guest
Mar 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3.  
  4. int main(){
  5.  
  6. int comp,N=0;
  7. float MMTF,MMTR,dispc,disps = 1;
  8. char resp;
  9. do{
  10. do{
  11. printf("DIGITE O NUMERO DE COMPONENTES:\n");
  12. scanf("%d",&comp);
  13. if (comp <= 0)
  14. printf("VALOR INVALIDO\n");
  15. }
  16. while(comp<=0);
  17.  
  18. for(N=0;N < comp;N++){
  19. do{
  20. printf("DIGITE O MMTF DO COMPONENTE %d:\n",N);
  21. scanf("%f",&MMTF);
  22.  
  23. printf("DIGITE O MMTR DO COMPONENTE %d:\n",N);
  24. scanf("%f",&MMTR);
  25. if (MMTR <= 0 || MMTR <=0)
  26. printf("VALOR INVALIDO\n");
  27. }
  28. while (MMTF<=0 || MMTR<=0);
  29.  
  30. dispc=MMTF/(MMTF*MMTR);
  31. disps=disps * dispc;
  32. printf("DISPONIBILIDADE DO COMPONENTE %d = %f\n",N,dispc);
  33. }
  34. printf("DISPONIBILIDADE DO SISTEMA É %f\n",disps);
  35. printf("DESEJA CONTINUAR? S/N\n");
  36. scanf("%c",resp);
  37. }while(resp = 'S');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement