Thanks that worked. BTW, how did you come up with while(3*x=>counter): Did you use trial and error methods to arrive at your result?
Type: Posts; User: noblegas
Thanks that worked. BTW, how did you come up with while(3*x=>counter): Did you use trial and error methods to arrive at your result?
when I changed my while(counter>=x) to while(counter>2) the output is now 2.
Hi again,
I am having issues with writing code for the taylor series e^x. here is my code:
//java program that asks the user to input a number that e^x=1+x+x^2/2! +x^3/3!...
import...
I already fixed it
I am trying to write a java program that prints out the number that is the mathematical constant e. As you input a number, the larger it gets , the closer it comes to 2.71828 . Here is my code:
...
Here is my code :
import java.util.Scanner;
public class smallestnumber
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
I am having a problem with my code where I asks the user to input two largest numbers. Here is my code
//java program that asks user to input a number and print the 1st and 2nd largest numbers
...
That is true. Do you think I should just changed the expression i*j!=0 to i*j==0 and print an if statement that skips composite numbers and then add an else if statement that only prints prime...
public class printprimes2{
public static void main(String[] args){
for( int i = 1 ; i <=199 ; i++ ) //iterate 1 - 199; 2 is prime
{
for ( int j = 2 ; j < i ; j++ ) //iterate 2...
So do you think I should reorder the forloops around? Ill try that. I modifiy the code and removed the counter. Now here is the code
//a java application that prints out composite numbers that...
I took your suggestion and and started with new slate. Here is my new code with comments
//a java application that prints out composite numbers that range from 1 to 100
public class...
Okay.
1. A composite number is a number that has factors other than 1 and itself.
2 declare two integer variables for two for loops
3. I write a forloop that loops around integer that range from...
I tried (num%i==0)instead of if(num%i!=0) same integers are displayed. What are your suggestions?
It isn't supposed to display the number zero, it is supposed to displayed numbers who have no remainders, ie composite numbers , which include all even numbers(accept two) and all odd numbers that...
Because since this code doesn't have a remainder(the remainder is zero) it should print out composite numbers
Oh, I forgot to add my comments. Oh well. Well the two for loops is supposed to displayed numbers that ranged from 1 to 100 and including 100. I added the if statement because when the for loop runs...
Hi,
I am trying to write a java application that displays composite numbers between 1 and 100. Here is the format of my code:
//a java application that prints out composite numbers that range...
There is an error in my code that pops when I tried to execute my java application for an exponent function that I wrote. Here is my code and here is the error is generated when I run my code:
//a...
I used double equal signsand that didn't even work
I want to displayed a table of pythagorean triples that until the values reach 500.The code above is supposed to be the equation for the pythagorean theorem and when I attempt to compile it, java...
Fixed most of my errors. Now only one error is generated when I attempt to compile the code:
//a java application that prints the table of pythagorean triples that go up to 500 using a for loop...
I have generated many errors in my code for this program but I particularly want to focused on the first error that comes up. Here is the outline of my code:
//a java application that prints the...
Nevermind , problem solved
Hi
I am having trouble compiling my code for a java application that is supposed to print out the infinite series for Pi. Here is my java code:
//a java application that generates the infinite...
I haven't learned boolean yet. I tried adding a charter string where I said n!='n' to exist out inside the while curly brackets , but that didn't some to work. Couldn't I just incorporate teh while...