Letícia Rodrigues
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Final session | Fund. Lógica >[color=blue]**Autor:** Letícia Rodrigues da Silva **Turma:** IndoD **Número:** 25 [TOC] ## Nível I ### Exercício 1 Faça uma função ÚNICA que a partir da base e altura, calcule a área do triângulo. ```csharp= public double AreaTriangulo (double basee, double altura) { double area = (basee * altura) / 2; return area; } double area = AreaTriangulo(10, 4.5); area // 22.5 ``` ### Exercício 2 Faça uma função ÚNICA que a partir do lado, calcule o perímetro do octógono. ```csharp= public double PerimetroOctogono (double lado) { double calcular = lado * 8; return calcular; } double calcular = PerimetroOctogono(5); calcular // 40 ``` ### Exercício 4 Faça uma função ÚNICA que a partir da diagonal maior e menor, calcule a área do losango. ```csharp= public double AreaLosango (double diagonal1, double diagonal2) { double calcular = (diagonal1 * diagonal2) / 2; return calcular; } double calcular = AreaLosango(8, 4.7); calcular // 18.8 ``` ### Exercício 5 Faça uma função ÚNICA que a partir da base e altura, calcule a área do paralelogramo. ```csharp= public int AreaParalelogramo (int basee, int altura) { int calcular = basee * altura; return calcular; } int calcular = AreaParalelogramo(10, 6); calcular // 60 ``` ## Nível II ### Exercício 1 Faça uma função ÚNICA que a partir do cateto oposto e adjacente, calculea hipotenusa. Arredonde a resposta para uma casa decimal. ```csharp= public double CalcularHipotenusa (double oposto, double adjacente) { double potenciax = Math.Pow(oposto, 5); double potenciay = Math.Pow(adjacente, 5); double calcular = potenciax + potenciay; double raiz = Math.Sqrt(calcular); double arredondartotal = Math.Round(raiz); return arredondartotal; } double total = CalcularHipotenusa(10, 12.7); total // 656 ``` ### Exercício 2 Faça uma função ÚNICA que a partir de um peso e altura de uma pessoa, calcule o IMC. Arredonde a resposta para duas casas decimais. ```csharp= public double CalcularIMC (int peso, double altura1, double altura2) { double imc = peso / (altura1 * altura2); double arredondarIMC = Math.Round(imc); return arredondarIMC; } double calcular = CalcularIMC(56, 1.60, 1.60); calcular // 22 ``` ### Exercício 4 Faça uma função ÚNICA que a partir da massa e velocidade, calcule a energia cinética. Obrigatório o uso da função Math.Pow. ```csharp= public double CalcularEnergiaCinetica (double massa, double velocidade) { double EC = (massa * velocidade) / 2; double potencia1= Math.Pow(velocidade, 3.5); double potencia2 = Math.Pow(velocidade, 3.5); double calcular = potencia1 + potencia2; return calcular; } double total = CalcularEnergiaCinetica(39, 14); total // 20534.21 ``` ### Exercício 5 Faça uma função ÚNICA que a partir da altura e raio, calcule o volume de um cilindro. Obrigatório o uso da função Math.Pow. ```csharp= public double CalcularVolumeCilindro (double pi, double raio, double altura) { double volume = pi * raio * altura; double potencia1 = Math.Pow(raio, 3); double potencia2 = Math.Pow(raio, 3); double calcular = potencia1 + potencia2; return calcular; } double total = CalcularVolumeCilindro(3.14, 3, 2); total // 54 ``` ## Nível III ### Exercício 1 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o primeiro nome. ```csharp= string ExtrairNome (string nome) { string nomecompleto = nome; string nomeCompleto = "Leticia Rodrigues da Silva"; string extrair = nomeCompleto.Substring(0,7); return extrair; } string nome = ExtrairNome("Leticia Rodrigues da silva"); nome // Leticia ``` ### Exercício 2 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o último nome. ```csharp= string ExtrairUltimoNome (string nome) { string nomecompleto = nome; int letras = nomecompleto.LastIndexOf(" "); string posicao = nomecompleto.Substring(letras); return posicao; } string nome = ExtrairUltimoNome("Leticia Rodrigues da silva"); nome // Silva ``` ### Exercício 3 Faça uma função ÚNICA que a partir de um e-mail de uma pessoa, extraia o domínio do e-mail. ```csharp= bool ValidarEmail (string email) { bool validar = email.Contains("@"); return validar; } bool result = ValidarEmail("soulinda@gmail.com"); result // True ``` ### Exercício 4 Faça uma função ÚNICA que a partir de um CEP, retorne verdadeiro/falso se o CEP contém o caractere hífen (-) e possui um total de 9 caracteres. ```csharp= bool ValidarCEP (string cep) { bool validar = cep.Length == 9 & cep.Contains("-"); return validar; } bool result = ValidarCEP("05987-310"); result // True ``` ## Nível IV ### Exercício 1 Faça uma função ÚNICA que a partir de uma data, descubra o último dia do mês a partir dessa data. ```csharp= public DateTime UltimoDiaMes (DateTime data) { DateTime ProxMes = new DateTime(data.Year, data.Month, 1); DateTime proximo = ProxMes.AddMonths(1); DateTime ultimodia = proximo.AddDays(-1); return ultimodia; } DateTime d = new DateTime(2021, 06, 28); DateTime result = UltimoDiaMes(d); result // 6/30/2021 12:00:00 AM ``` ### Exercício 3 Faça uma função ÚNICA que a partir de uma data, retorne verdadeiro/falso se a data pertence ao segundo trimestre do ano. ```csharp= public bool SegundoTrimestre (DateTime data) { int mes = data.Month; bool m = mes <= 6 && mes >= 4; return m; } DateTime t = new DateTime(2021,8,15); bool s = SegundoTrimestre(t); s ``` ### Exercício 4 Faça uma função ÚNICA que a partir de uma data, retorne verdadeiro/falso se a pessoa tem mais de 18 anos a partir do dia atual. ```csharp= public bool Maior18 (DateTime nascimento) { DateTime limitedata = DateTime.Now.AddYears(-18); bool maior = nascimento <= limitedata; return maior; } DateTime m = new DateTime(1982, 10, 08); bool result = Maior18(m); result // True ``` ### Exercício 5 Faça uma função ÚNICA que a partir de uma data, retorne verdadeiro/falso se a data pertence a primeira quinzena do mês. ```csharp= public bool PrimeiraQuinzena (DateTime data) { int dias = data.Day; bool d = dias <= 15; return d; } DateTime q = new DateTime(2021,8,15); bool p = PrimeiraQuinzena(q); p // True ``` ## Nível V ### Exercício 4 Faça uma função COMPOSTA que a partir de dois nomes completos, retorne verdadeiro/falso se as pessoas são da mesma família, comparando o último nome das duas pessoas. ```csharp= public bool MesmaFamilia (string nome1, string nome2) { string sobrenome1 = UltimoNome(nome1); string sobrenome2 = UltimoNome(nome2); bool nomecompleto = sobrenome1 == sobrenome2; return nomecompleto; } public string UltimoNome (string nome1) { int espaco = nome1.LastIndexOf(" "); int nome = nome1.Length; string sobrenome1 = nome1.Substring(espaco,nome-espaco); string n = sobrenome1.Trim(); return n; } string nome1= "Henry Zarlenga Viana"; string n1 = "Josefina Rodrigues Fina"; bool nomE = MesmaFamilia(nome1,n1); nomE // False ``` ### Exercício 5 Faça uma função COMPOSTA que a partir de duas datas de nascimento, retorne verdadeiro/false se as duas pessoas forem do signo de libra. ```csharp= public bool Libra(DateTime nascimento) { bool pessoa1 = nascimento.Month == 9 && nascimento.Day > 22; bool pessoa2 = nascimento.Month == 10 && nascimento.Day < 23; bool libra = pessoa1 == true || pessoa2 == true; return libra; } public bool Signo(DateTime pessoa1, DateTime pessoa2) { bool p1 = Libra(pessoa1); bool p2 = Libra(pessoa2); bool result = p1 == p2; return result; } bool s = Signo(new DateTime(2003, 08, 20), new DateTime(1992, 10, 1)); s // False ``` ### Exercício 1 Faça uma função COMPOSTA que a partir dos valores 'a', 'b' e 'c’, calcule o valor de 'x’ baseado na equação de segundo grau. ```csharp= public double ValorX (int a, int b , int c) { double potencia = Math.Pow ( -b, 2); double raizB = Math.Sqrt ( potencia - 4 * a * c); return raizB; } public string Bhaskara (int a, int b, int c) { double calcularbhaskara1 = (-b + ValorX(a, b, c)) / 2 * a; double calcularbhaskara2 = (-b - ValorX(a, b, c)) / 2 * a; string e = "segundograu = " + calcularbhaskara1+ ", " + calcularbhaskara2 + ""; return e; } string result = Bhaskara (10, 06, -05); result // segundograu = 46.8114574786861, -106.811457478686 ``` ### Exercício 3 ```csharp= public double CalcularPG (double q, double n) { double progressao = (n-1); return Math.Pow(q, progressao); } public double ProgressaoGeometrica (double total, double q, double n) { double p = total * CalcularPG(q, n); return p; } double result = ProgressaoGeometrica (5.7, 8, 2); result // 45.6 ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully