tag:blogger.com,1999:blog-7850692473012665527.post405200907887766862..comments2023-10-18T05:07:16.474-04:00Comments on the "How Can Renee Make This Code Better?" blog: Program to Reverse the Digits in an IntegerHello, I'm Renee.http://www.blogger.com/profile/02081872116763616695noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7850692473012665527.post-34896517226365582252016-08-03T10:11:44.929-04:002016-08-03T10:11:44.929-04:00The creation of the variable temp is not really ne...The creation of the variable temp is not really necessary here. The algorithm would work just fine if you only use:<br /><br />while (n > 0) {<br /> reverse = (reverse * 10) + (n % 10);<br /> n /= 10; //deletes the last digit<br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-47579999716927665852013-06-07T18:20:34.422-04:002013-06-07T18:20:34.422-04:00Luckily, fleshlight there are
still some limitati...Luckily, <a href="http://fleshlight.over-blog.com/" rel="nofollow">fleshlight</a> there are <br />still some limitations without Flash. According to a patent filing that went <br />public just weeks ago, listing co-founder and CEO Mark Zuckerberg as <br />a child, we decided to transfer all three.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-5294964452826330392013-05-29T23:08:32.737-04:002013-05-29T23:08:32.737-04:00Hey! It seems as though we both have a interest fo...Hey! It seems as though we both have a interest for the same thing.<br /><br />Your blog, "Blogger: the "How Can Renee Make This Code <br />Better?" blog" and mine are very similar. Have you ever thought about authoring a guest write-up for a related blog?<br />It will unquestionably help gain exposure to <br />your website (my site recieves a lot of targeted <br />traffic). If you might be interested, e-mail me at: katherin_oates@gmail.<br />com. Appreciate it<br /><br />Feel free to surf to my web-site; <a href="http://wikicars.org/fr/Discussion_Utilisateur:JacobFred" rel="nofollow">memory stick sony</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-41139088161901120652012-09-29T20:21:24.504-04:002012-09-29T20:21:24.504-04:00import acm.program.*;
// This program asks the us...import acm.program.*;<br /><br />// This program asks the user for a number up to "+ELEMENTS" long and returns the digits to the user in a print statement in reverse order.<br />public class reverseorder extends ConsoleProgram {<br /> <br /> // Elements in the array "digit"<br /> private static final int ELEMENTS = 10;<br /> <br /> public void run(){<br /> <br /> <br /> <br /> int digit[] = new int[ELEMENTS]; // Initializing an array with "+ELEMENTS" as the size.<br /> int count = 0;<br /> int index = 0; <br /> <br /> <br /> //String type variable is used because using an int would cause leading 0's to be truncated.<br /> //Because this is being taken in as a string , it will need to be converted to an int using the parseInt method.<br /> <br /> String sVal = readLine("Enter a positive interger value up to "+ELEMENTS +" digits.");<br /> <br /> <br /> //Takes the value of sVal and sends it to the .length method to get the number of characters in the sVal variable.<br /> //This value will be used as the iterator in later loops.<br /> count =(sVal.length());<br /> <br /> <br /> while (count > ELEMENTS) {<br /> sVal = readLine("Value is too long please enter a number of "+ELEMENTS +" or fewer digits.");<br /> }<br /> <br /> //This takes the input String value of Sval and passes it to the parseInt method to be converted to an int.<br /> //This is done so that a count can be established for the amount of numbers in the String variable.<br /> <br /> int val = Integer.parseInt(sVal);<br /> <br /> <br /> <br /> while(index < count) {<br /> //The last digit is chopped off and stored in the corresponding index element of the array.<br /> digit[index] = digittrunc(val);<br /> <br /> //The remaining digits get placed in val and the loop starts over using the new val.<br /> val = digitreturn(val);<br /> index ++;<br /> <br /> }<br /> <br /> <br /> <br /> print("The reverse order of " +sVal +" is ");<br /> for (int i = 0;i < count; i++){<br /> print(+digit[i]);<br /> }<br /> <br /> }<br /> <br /> <br />// Everything after this point is a method.<br /> <br /> <br /> // This method returns everything except the last digit of the current int val.<br /> private int digitreturn(int c) {<br /><br /> int dReturn = c /10;<br /> return dReturn;<br /> }<br /> <br /> //This method returns the last digit of the current int val.<br /> <br /> private int digittrunc(int c){<br /> <br /> int dTrunc = c % 10;<br /> return dTrunc;<br /> }<br /> <br /> <br /> <br /> <br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-30428284930885006012012-09-29T20:20:31.218-04:002012-09-29T20:20:31.218-04:00it also doesnt work if you use a number with leadi...it also doesnt work if you use a number with leading 0'sAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-65752235390089482382012-04-03T12:34:35.188-04:002012-04-03T12:34:35.188-04:00in fact, this program will not work fine when the ...in fact, this program will not work fine when the integer is 10 or 1000 or any other like this.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-46513820762202105592009-12-02T00:00:13.520-05:002009-12-02T00:00:13.520-05:00In Common Lisp:
http://gist.github.com/246956In Common Lisp:<br /><br />http://gist.github.com/246956kd5bjohttps://www.blogger.com/profile/05598475202682026587noreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-39267714256309096092009-11-01T23:31:36.697-05:002009-11-01T23:31:36.697-05:00Done! thanksDone! thanksHello, I'm Renee.https://www.blogger.com/profile/02081872116763616695noreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-89887753148834087522009-11-01T23:25:19.955-05:002009-11-01T23:25:19.955-05:00I will leave you a purely meta/stylistic comment s...I will leave you a purely meta/stylistic comment since you seemed to have no problem with the coding part. <br /><br />You should use pre tags for your code! Right now the leading spaces are getting stripped because it's html. If you used pre's, the code would appear properly indented. That would make it way easier for me to read your code.Emmetthttps://www.blogger.com/profile/08987859844208600237noreply@blogger.com