Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int n =1;
  7.  
  8. while(n !=0)
  9. {
  10. float maior_p, menor_p;
  11. float subtracao = 0;
  12. float dist = 0;
  13. int num = 0, num1 = 0;
  14. float pont = 0;
  15. int cont = 0;
  16.  
  17. printf ("Digite o maior ponto:\n");
  18. scanf ("%f", &maior_p);
  19.  
  20. printf ("Digite o menor ponto:\n");
  21. scanf ("%f", &menor_p);
  22.  
  23. subtracao = maior_p - menor_p;
  24.  
  25. printf ("Digite a distância real entre os pontos(cm):\n");
  26. scanf ("%f", &dist);
  27.  
  28. num = menor_p;
  29. num1 = maior_p;
  30. if (num1 > num)
  31. {
  32. while (num1 > num)
  33. {
  34. num++;
  35. cont++;
  36. pont = num - menor_p;
  37. pont = pont * dist;
  38. pont = pont / subtracao;
  39. printf ("O %d° ponto fica a:\n%f cm\n", cont, pont);
  40. }
  41. }
  42. if (num1 <= num) cont = 0;
  43.  
  44. printf ("Deseja continuar?\nSim - Digite 1: \nNÃO - Digite 0:\n");
  45. scanf ("%d", &n);
  46. if (n == 1)
  47. {
  48. system("clear");
  49. }
  50.  
  51. }
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement