{"id":78965,"date":"2021-12-02T14:18:28","date_gmt":"2021-12-02T14:18:28","guid":{"rendered":"https:\/\/papersspot.com\/blog\/2021\/12\/02\/question-how-to-reverse-number-in-java-solution-import-java-util-scanner-public\/"},"modified":"2021-12-02T14:18:28","modified_gmt":"2021-12-02T14:18:28","slug":"question-how-to-reverse-number-in-java-solution-import-java-util-scanner-public","status":"publish","type":"post","link":"https:\/\/papersspot.com\/blog\/2021\/12\/02\/question-how-to-reverse-number-in-java-solution-import-java-util-scanner-public\/","title":{"rendered":"QUESTION How to reverse number in java ? SOLUTION import java.util.Scanner; public"},"content":{"rendered":"<p>QUESTION<\/p>\n<p> How to reverse number in java\u00a0?<\/p>\n<p> SOLUTION<\/p>\n<p> import java.util.Scanner;<\/p>\n<p> public class Main<\/p>\n<p> {<\/p>\n<p> public static void main(String args[])<\/p>\n<p> {<\/p>\n<p> int nbr, r = 0;<\/p>\n<p> System.out.print(&#8220;Enter a number to reverse: &#8220;);<\/p>\n<p> Scanner sc = new Scanner(System.in);<\/p>\n<p> nbr = sc.nextInt();<\/p>\n<p> while(nbr != 0)<\/p>\n<p> {<\/p>\n<p> r = r * 10;<\/p>\n<p> r = r + nbr;<\/p>\n<p> nbr = nbr\/10;<\/p>\n<p> }<\/p>\n<p> System.out.println(&#8220;The reciprocal of the number is&#8221; + r);<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> QUESTION 2<\/p>\n<p> Calculate the sum of even numbers\u00a0?<\/p>\n<p> SOLUTION<\/p>\n<p> import java.util.Scanner;<\/p>\n<p> public class Main {<\/p>\n<p> public static void main(String[] args) <\/p>\n<p> {<\/p>\n<p> int n, i, p = 0;<\/p>\n<p> Scanner sc = new Scanner(System.in);<\/p>\n<p> System.out.print(&#8220;enter a number : &#8220;);<\/p>\n<p> n = sc.nextInt(); <\/p>\n<p> for(i = 1; i &lt;= n; i++)<\/p>\n<p> {<\/p>\n<p> if(i % 2 == 0)<\/p>\n<p> {<\/p>\n<p> p = p + i; <\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> System.out.println(&#8220;the sum of even numbers from 1 to &#8220;+n+&#8221; = &#8220;+p);<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> QUESTION<\/p>\n<p> Test if a character is a letter\u00a0?<\/p>\n<p> SOLUTION<\/p>\n<p> public class Main {<\/p>\n<p> public static void main(String[] args) {<\/p>\n<p> char ch = &#8216;?&#8217;;<\/p>\n<p> if((ch &gt;= &#8216;A&#8217; &amp;&amp; ch = &#8216;a&#8217; &amp;&amp; ch &lt;= &#039;z&#039;)){<\/p>\n<p> System.out.println(ch + &#8221; is a number.&#8221;);<\/p>\n<p> }<\/p>\n<p> else{<\/p>\n<p> System.out.println(ch + &#8221; is not a number.&#8221;);<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QUESTION How to reverse number in java\u00a0? SOLUTION import java.util.Scanner; public class Main { public static void main(String args[]) { int nbr, r = 0; System.out.print(&#8220;Enter a number to reverse: &#8220;); Scanner sc = new Scanner(System.in); nbr = sc.nextInt(); while(nbr != 0) { r = r * 10; r = r + nbr; nbr = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10],"class_list":["post-78965","post","type-post","status-publish","format-standard","hentry","category-research-paper-writing","tag-writing"],"_links":{"self":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/78965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/comments?post=78965"}],"version-history":[{"count":0,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/78965\/revisions"}],"wp:attachment":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/media?parent=78965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/categories?post=78965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/tags?post=78965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}