{"id":640,"date":"2017-02-08T22:14:22","date_gmt":"2017-02-09T00:14:22","guid":{"rendered":"http:\/\/www.galirows.com.br\/meublog\/programacao\/?p=640"},"modified":"2021-06-18T15:19:11","modified_gmt":"2021-06-18T18:19:11","slug":"mostrar-vetor-com-condicoes","status":"publish","type":"post","link":"http:\/\/www.galirows.com.br\/meublog\/programacao\/mostrar-vetor-com-condicoes\/","title":{"rendered":"Mostrar vetor com condi\u00e7\u00f5es"},"content":{"rendered":"\n<p>Elabore um algoritmo que leia 10 valores e em seguida <strong>mostre todos os valores<\/strong> pares ou m\u00faltiplos de 5. Tamb\u00e9m mostre <strong>quantos<\/strong> valores \u00edmpares e negativos existem. Ao final, mostre todos os valores negativos digitados, na ordem contr\u00e1ria em que foram digitados.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><strong>Solu\u00e7\u00e3o em linguagem C<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code lang:c decode:true\"><code lang=\"c\" class=\"language-c\">#include &lt;stdio.h&gt;\n\n#define TAM 10\n\nint main(void) {\n\tint vet[TAM], i, cont = 0;\n\t\n\tfor (i = 0; i &lt; TAM; i++) {\n\t\tscanf(\"%i\", &amp;vet[i]);\n\t\tif (vet[i] % 2 == 0 || vet[i] % 5 == 0) {\n\t\t\tprintf(\"%i \", vet[i]);\n\t\t} \n\t\tif (vet[i] % 2 == 1 &amp;&amp; vet[i] &lt; 0) {\n\t\t\tcont++;\n\t\t}\n\t}\n\tprintf(\"\\nCont: %i\\n\", cont);\n\t\n\tfor (i = TAM-1; i &gt;= 0; i--) {\n\t\tif (vet[i] &lt; 0) {\n\t\t\tprintf(\"%i \", vet[i]);\n\t\t}\n\t}\n\t\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00eddeo explicativo<\/strong><\/p>\n\n\n\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/H_--mAF2Tpk\" allowfullscreen=\"allowfullscreen\" width=\"600\" height=\"400\" frameborder=\"0\"><\/iframe><\/p>\n\n\n\n<p><strong>Link para o v\u00eddeo:<\/strong> <a href=\"https:\/\/youtu.be\/H_--mAF2Tpk\" target=\"_blank\" rel=\"noopener\">https:\/\/youtu.be\/H_&#8211;mAF2Tpk<\/a><\/p>\n\n\n\n<p><strong>Confira o c\u00f3digo em:<\/strong> <a href=\"http:\/\/ideone.com\/Ysbiul\" target=\"_blank\" rel=\"noopener\">http:\/\/ideone.com\/Ysbiul<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Elabore um algoritmo que leia 10 valores e em seguida mostre todos os valores pares ou m\u00faltiplos de 5. Tamb\u00e9m mostre quantos valores \u00edmpares e negativos existem. Ao final, mostre todos os valores negativos digitados, na ordem contr\u00e1ria em que foram digitados.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[36,14],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-c","category-videos","tag-for","tag-vetor"],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":5,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":1063,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/posts\/640\/revisions\/1063"}],"wp:attachment":[{"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.galirows.com.br\/meublog\/programacao\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}