Skip to content

O programa substitui todos os números pares e diferentes de zero, do array, pelo número 0 ou -1.

Notifications You must be signed in to change notification settings

apaulineoliveira/substituindo-numeros-pares

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

🤖 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.

About

O programa substitui todos os números pares e diferentes de zero, do array, pelo número 0 ou -1.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published