Can anyone help me make an algorithm (Flowchart) for my java program? Please!
@Jaynator495
Oh, because this was in math, i was ready to yell DANG IT SHADOW I DONT HELP IN MATH, but since this is a programming question...
Proceed! LOL
xD
i need help checking if my code is correct, and also how to do the flowchart?
Post away
thats what i had to do
Ok...
import java.util.Scanner; public class Chpt6_Project { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num1; int num2; int num3; int sum; System.out.print("Enter three numbers: "); num1 = input.nextInt(); num2 = input.nextInt(); num3 = input.nextInt(); sum = num1 + num2 + num3; System.out.println("The sum is: " + sum); if(isPrime(sum)) System.out.println("The sum is a prime"); else System.out.println("The sum is not a prime"); } public static boolean isPrime(int n) { if (n%2==0) return false; //even numbers are not prime for(int i=3;i<n;i+=2) { //loop through all odd numbers if(n%i==0) return false; //if n is divisible by a number, it's not prime } return true; //otherwise n is prime } }
thats my code
its my first semester, so if i did everything wrong, please go easy jaja
TIP \``` CODE HERE \```
That looks good. Yep you did good
that will result in ``` CODE HERE ```
what?
i just see CODE HERE?
WERE SO CONFUSED :B
is my code wrong?
Yes, put your code in between the \``` This \```
Your code is fine though! lol
im not understanding ,sorry
you may also like Visual Studio Community from microsoft, i believe they allow java applications...
i use Eclipse?
Thats works to ._.
could you help me with the flowchart?
@Jamierox4ev3r
I presume you mean a chart that represents the different paths of the scripts execution?
yes
Well, i think i just answered your question. Just make a chart of the scripts execution with each path, here's an example of one. |dw:1478127929287:dw|
uh, that example is broken o-o
lol, i mean, i know what it should look like, i just need guidance on the steps, and whether i need 2 because of the isPrime
Alrighty, here is a example on what it might look like generated from http://code2flow.com/# (honestly, it will simply split on each true false, and merge..) Minus all the unneeded code being added into it
Sorry, i'm to lazy to make a actual flow chart x'D i think you can make one in word ._.
thanks lol
np xD
Join our real-time social learning platform and learn together with your friends!