Advertisement
orenansouza

Triangulos com funçao

Jun 5th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. /*
  4. int soma (int a, int b){
  5. int s;
  6. s=a+b;
  7. printf("\n soma = %d",soma);
  8. }
  9. int main(){
  10. int x,y; //variaveis locais
  11. printf("\n digite os numeros x e y");
  12. scanf("%d%d",&x,&y);
  13. soma(x,y);
  14.  
  15.  
  16. }
  17.  
  18.  
  19. int base,altura,s; //Variaveis Globais
  20.  
  21. int area () // nao tem ponto e virgula
  22. {
  23. printf("Digite o valor da base e da altura, respectivamente\n");
  24. scanf("%d%d",&base,&altura);
  25. s=(base*altura)/2;
  26. return s;
  27. }
  28.  
  29. int main(){
  30. int rarea;
  31. rarea=area();
  32.  
  33. printf("resultado da area = %d",rarea);
  34. }
  35. */
  36.  
  37. int a,b,c,res; //Variaveis Globais
  38.  
  39. int tipo() // nao tem ponto e virgula
  40. {
  41. printf("Digite o valor dos lados do triangulo\n");
  42. scanf("%d%d%d",&a,&b,&c);
  43.  
  44. if((a=b) && (b=c)){
  45. res=1;
  46. }
  47. else{
  48. res=0;
  49. }
  50. return res;
  51.  
  52. }
  53.  
  54. int main(){
  55. int resultado;
  56. resultado=tipo();
  57.  
  58. if (resultado=1){
  59. printf("triangulo equilatero");
  60. }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement