Results 1 to 2 of 2
Thread: How to post code
- 10-25-2012, 10:03 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
How to post code
try
import java.util.Scanner;
public class Help {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter a number: ");
int intNumber = scanner.nextInt();
String strNumber = String.valueOf(intNumber);
int intNumberOfSevens = 0;
char chrComparison = '7';
for(int i = 0;i < strNumber.length();i++) {
char chrTemp = strNumber.charAt(i);
if(chrComparison == chrTemp) {
intNumberOfSevens++;
}
}
System.out.println("Number of seven's is : " + intNumberOfSevens);
}
}
and my question is how do you print code like that on the forum
- 10-25-2012, 10:09 AM #2
Re: How to post code
Removed from Counting # of 7's in an integer
When you have a question, start your own thread. Don't hijack another poster's thread with an unrelated question.
There are several links near the top of every forum page, did you try clicking around to see what you could discover about using the forum?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Code question. Where to post.
By Tullamore in forum New To JavaReplies: 6Last Post: 04-06-2012, 05:10 AM -
Problem with Code to post a simple message to facebook wall
By Sunanda in forum Apache CommonsReplies: 0Last Post: 01-11-2012, 07:29 AM -
DOnt know if 1st post if did, I am VERY sorry for duplicate post. I have error messg
By afisher300 in forum New To JavaReplies: 3Last Post: 05-04-2009, 03:15 AM -
Please post your suggestions about this code
By mathansj in forum Advanced JavaReplies: 8Last Post: 02-15-2009, 03:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks