Advertisement
vctrh

Exercícios 1-2: Aula 11 - Software R (parte 4)

Aug 25th, 2021
590
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. raizes <- function(a,b,c){
  2.   delta <- b*b-4*a*c
  3.   if(delta < 0){
  4.     cat("Raizes complexas")
  5.   }
  6.   else{
  7.     raiz1 <- (-b-sqrt(delta)) /(2*a)
  8.     raiz2 <- (-b+sqrt(delta)) /(2*a)
  9.     cat("As raizes sao: ", raiz1, "e", raiz2)
  10.   }
  11. }
  12.  
  13. raizes(1,3,5)
  14.  
  15. areatrapezio <- function(B,b,h){
  16.   A<-((B+b)/2)*h
  17.   return(A)
  18. }
  19.  
  20. areatrapezio(b=2,B=5,h=1)
Advertisement
RAW Paste Data Copied
Advertisement