Git Product home page Git Product logo

substituindo-numeros-pares's Introduction

🤖 Objetivo

O intuito deste projeto foi elaborar um programa que substituisse todos os números pares e diferentes de zero, do array, pelo número 0. Se o array for vazio o programa retornará então -1.

A ideia central foi itensificar os conhecimentos acerca da manipulação de arrays e do laço de repetição for (if, else if). Com esse exercício foi possível compreender como funciona e a real "potência" da propriedade length de um array. Usei a palavra potência em aspas exatamente por ter percebido a infinidade de coisas que podem ser feitas utilizando essa propriedade. A qual caracteriza-se por retornar ou definir o número de elementos em um determinado array.

Com else if foi criado uma condicional pegando o valor do módulo de 2 ( % 2), deste modo, foi possível identificar os números pares que constam no array e, assim, substituí-los por zero.



🤖 Purpose

The goal of this project was to develop a program that would replace all even numbers and different from zero, in the array, by the number 0. If the array is empty then the program will return -1.

The main idea was to intensify the knowledge about the manipulation of arrays and the for (if, else if) loop. With this exercise it was possible to understand how it works and the real "power" of the length property of an array. I used the word power in quotation marks precisely because I realized the infinite number of things that can be done using this property. Which is characterized by returning or defining the number of elements in a given array.

With else if a conditional was created taking the value of the modulus of 2 ( % 2) , in this way, it was possible to identify the even numbers that appear in the array and, thus, replace them with zero.

substituindo-numeros-pares's People

Contributors

apaulineoliveira avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.