pedro gomes
    • 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. de Lógica Nome: Pedro Henrique Gomes De Oliveira Sardinha Turma: InfoB Número: 41 ## Nível 1 ### Exercício 1 Faça uma função que a partir da base e altura, calcule a área do triângulo. ```csharp= using System; public double CalcularAreaTriangulo (int alt, int baset) { int x = alt * baset; int area = x/2; return area; } double x = CalcularAreaTriangulo(10, 6); x =30 ``` ### Exercício 2 Faça uma função ÚNICA que a partir do lado, calcule o perímetro do octógono. ```csharp= using System; public double AreadoPerimetro (double lado) { double perimetro = lado * 8; return perimetro; } double x = AreadoPerimetro (10); x =80 ```` ### Exercício 3 Faça uma função ÚNICA que a partir da base maior, base menor e altura, calcule a área do trapézio. ```csharp= using System; public double AreaTrapezio (double menor, double maior, double Altura) { double area = (menor * maior * Altura) / 2; return area; } double x = AreaTrapezio (5, 8, 15); x =300 ```` ### Exercício 4 Faça uma função ÚNICA que a partir da diagonal maior e menor, calcule aárea do losango. ```csharp= using System; public double calcularAreadolosango (double Maior, double Menor) { double area = (Maior * Menor) / 2; return area; } double x = calcularAreadolosango (12, 10); x =60 ```` ### Exercício 5 Faça uma função ÚNICA que a partir da base e altura, calcule a área do paralelogramo. ```csharp= using System; public double CalcularAreaParaleleogroma (double bas, double altura) { double area = (bas * altura) / 2; return area; } double x = CalcularAreaParaleleogroma (10,14); x =70 ```` ## Nível II ### Exercício 1 Faça uma função ÚNICA que a partir do cateto oposto e adjacente, calcule a hipotenusa Arredonde a resposta para uma casa decimal. ```csharp= using System; public double CalcularHipotenusa (double Adjacente, double Oposto) { double soma = Math.Pow (Adjacente, 2) + Math.Pow (Oposto, 2); double soman = Math.Round(soma, 1); double raiz = Math.Sqrt(soma); return Math.Pow (raiz, 1); } double x = CalcularHipotenusa (9,12 ); x =15 ```` ### 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= using System; public double CalcularImc (double peso, double altura) { double pesoPoraltura = (peso / (Math.Pow(altura, 2))); return Math.Round (pesoPoraltura, 2); } double x = CalcularImc (63, 1.79); x =19.66 ```` ### Exercício 3 Faça uma função ÚNICA que a partir de um capital, parcelas e taxa de juros, calcule o juros compostos Arredonde a resposta para uma casa decimal. ```csharp= using System; public double juroscompostos (double capitalinicial, int a, int b) { double juros = capitalinicial * 1 + (a/0.1 * b); return juros; } double X = juroscompostos (100, 25, 2); X =600 ```` ### 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= using System; public double CalcularEnergiaCinetica (double Ma, double Velo) { double Ec = Math.Pow (Velo, 2); double Ec1 = ((Ma * Ec) / 2); return Ec1; } double x = CalcularEnergiaCinetica (15, 20); x =3000 ```` ## Níviel 3 ### Exercício 1 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o primeiro nome. ```csharp= using System; public string PrimeiroNome (string w) { int espaco = w.LastIndexOf(" "); string nome = w.Substring(0, espaco); string t = nome.Trim( ); return t; } string x = "Wellington Alves"; string m = PrimeiroNome(x); m =Wellington ``` ### Exercício 2 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o último nome. ```csharp= using System; public string UltimoNome (string a) { int espaco = a.LastIndexOf (" "); string nome = a.Substring (9,espaco); string v = nome.Trim(); return v; } string x = "vinicius oliveira"; string sobrenome = UltimoNome(x); sobrenome =oliveira ```` ### 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= using System; public bool VFCEP (string b) { bool contem = b.Contains ("-"); int caracter = b.Length; bool falso = caracter >= 9 && contem == false; return falso; } bool x = VFCEP ("428-298-118"); x =false ````### Exercício 5 Faça uma função ÚNICA que a partir de um telefone com máscara e DDD incluído ex (11) 94343 0808 retorne apenas os números do telefone ex 11943430808. ```csharp= using System; public string VoltarTelefone (string telefone) { string t = telefone.Replace(" ", "").Replace("(","").Replace(")", "").Replace("-", ""); return t; } string x = VoltarTelefone ("(11) 96088-0314"); x =11960880314 ```` ## Níviel 4 ### 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= using System; public DateTime UltimoDiadoMes (DateTime data) { DateTime Ultimo = new DateTime (data.Year, data.Month, DateTime.DaysInMonth(data.Year, data.Month)); return Ultimo; } DateTime x = new DateTime(2019,02,03); DateTime d = UltimoDiadoMes(x); d =2/28/2019 ```` ### Exercício 2 Faça uma função ÚNICA que a partir de uma data, descubra o primeiro dia do próximo mês a partir dessa data. ```csharp= using System; public DateTime PrimeiroDiadoMes (DateTime data) { DateTime firat = new DateTime (data.Year, data.Month, 1); DateTime last = firat.AddMonths(1); return last; } DateTime a = new DateTime(2019,02,28); DateTime x = PrimeiroDiadoMes (a); x =3/1/2019 ```` ### 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= using System; public bool SegundoTrimestre (DateTime data) { int mes = data.Month; bool calcula = mes >= 1 && mes <= 5; return calcula; } DateTime a = new DateTime(2020, 02, 05); bool x = SegundoTrimestre (a); x =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= using System; public bool PrimeiraQuinzenaDoMes (DateTime data) { int x = data.Day; bool resposta = x >= 1 && x <= 15; return resposta; } DateTime a = new DateTime (2021 ,02,01); bool x = PrimeiraQuinzenaDoMes (a); x =true ```` ## Níviel 5 ### Exercício 1 Faça uma função COMPOSTA que a partir dos valores 'a', 'b' e 'c' calcule o valor de ' baseado na equação de segundo grau. ```csharp= using System; public double CalcularValor (double a, double b, double c) { double t = PrimeroValor (b,c); double u = t/a; return u; } public double PrimeroValor (double b, double c) { return (c-b); } double x = CalcularValor (2, 15, 25); x =5 ```` ### Exercício 2 Faça uma função COMPOSTA que encontre um termo de uma PA (Progressão Aritmética), a partir do primeiro termo, razão e posição do termo que deseja encontrar. ```csharp= using System; public double TermoPA (double termo, double razao, double posicao){ return termo + (Conta(posicao, razao)); } public double Conta (double posicao, double razao) { return (posicao - 1) * razao; } double a = TermoPA(4, 4, 500); a =2000 ```` ### Exercício 3 Faça uma função COMPOSTA que encontre um termo de uma PG (Progressão Geométrica), a partir do primeiro termo, razão e posição do termo que deseja encontrar ```csharp= using System; public double TermoPG (double pTermo, double razao, double posicaoDoTermo) { double calculoRazao = Math.Pow(razao, CalculoPosicao(posicaoDoTermo)); double calculoTotal = pTermo * calculoRazao; return calculoTotal; } public double CalculoPosicao (double posicaoDoTermo) { return posicaoDoTermo - 1; } double a = TermoPG (6, 6, 3); a =216 ```` ### 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= using System; public bool UltimoNome (string a, string b) { string sobrenome1 = UltimoNome(a); string sobrenome2 = UltimoNome(b); bool x = sobrenome1 == sobrenome2; return x; } public string UltimoNome (string a) { int espaco1 = a.LastIndexOf(" "); int todas1 = a.Length; string sobrenome1 = a.Substring(espaco1,todas1-espaco1); string k = sobrenome1.Trim(); return k; } string p= "Pedro Gomes"; string k = "Keanu Reeves"; bool x = UltimoNome (p,k); x =false ````

    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