{"id":1045,"date":"2025-10-28T18:08:49","date_gmt":"2025-10-28T18:08:49","guid":{"rendered":"https:\/\/javigomez.org\/?p=1045"},"modified":"2025-12-05T16:53:10","modified_gmt":"2025-12-05T16:53:10","slug":"ar04-03-adivinar-numero-secreto","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2025\/10\/28\/ar04-03-adivinar-numero-secreto\/","title":{"rendered":"AR04.03 Adivinar n\u00famero secreto"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">Pedir un n\u00famero por pantalla hasta acertar el numSecreto. Decir si el numero introducido es mayor o menor del numSecreto<\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"AR04.03 Adivinar n\u00famero secreto\" width=\"1200\" height=\"900\" src=\"https:\/\/www.youtube.com\/embed\/MyzrXFvjdCA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Scanner;\n\npublic class AR0403 {\n    public static void main(String&#91;] args) {\n        int numSecreto = (int) (Math.random() * 100 + 1);\n\n        \/\/Pedir un n\u00famero por pantalla hasta acertar el numSecreto\n        \/\/Decir si el numero introducido es mayor o menor del numSecreto\n\n        Scanner sc = new Scanner(System.in);\n        System.out.print(\"N\u00famero: \");\n        int num = sc.nextInt();\n        while(num!=numSecreto){\n\n            if (num>numSecreto) System.out.println(\"El n\u00famero introducido es mayor del secreto\");\n            else System.out.println(\"El n\u00famero introducido es menor del secreto\");\n\n            System.out.print(\"N\u00famero: \");\n            num = sc.nextInt();\n\n        }\n\n\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Pedir un n\u00famero por pantalla hasta acertar el numSecreto. Decir si el numero introducido es mayor o menor del numSecreto<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[203],"class_list":["post-1045","post","type-post","status-publish","format-standard","hentry","category-java","tag-java"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=1045"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1045\/revisions"}],"predecessor-version":[{"id":1046,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1045\/revisions\/1046"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=1045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=1045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=1045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}