thanks and how would I be sure that its returning degrees(I dont want Radians)?and what of the regular cos(double x) that one is giving me an error too?
Type: Posts; User: Delstateprogramer
thanks and how would I be sure that its returning degrees(I dont want Radians)?and what of the regular cos(double x) that one is giving me an error too?
Hello all you Java programmers out there. I have a tiny problem. The code is not allowing me to use the cos(double x) and acos(double x) methods even though I imported the math class. So....Whats...
it worked thx alot man
ok thx ill try that
hey i tried it.. maybe i invoked the method at the wrong point. there is an infinite recursion some where. Heres the code
public static void main(String[] args) {
...
Alright guys and girls got a new one I need a lil help with. Im currently writing a program that is supposed to add the elements in a array and return the sum. Its supposed to be a recursive method...
lol the code works and that all that matters
Thank you for your help everyone i figured the problem out heres the code i used
public static int addDigits(int number)
{
if(number<10)
{
sum=number+sum;
}
else
Tried this code and it didnt work
if(number<10)
{
return number;
}
else
{
return (number%10)+((addDigits(number/10)));
Ok thx ill try that out
how do i save the prior digits to add them up at the end becuz here they keep changing and are not saved so they cant be added at the end
The user should be able to enter any integer and the program should output the sum of the digits in the integer.
I didnt intend for it to be a number 1 through 99. It would not matter what the user put in. and yes it would add the digits in an integer. Heres an example.
If the user entered the integer 223...
thats the new code but yea its a logical error in there somewhere
public class AddEmUp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Enter an integer:");
...
yes thats exactly it and I fear i thought i got it but i didnt still need some help lol
Nvm all i got it
Changed my mind not gonna use an array, ive decided to do something like this but its not really working and i kno why but i dnt know how to change itm
while(number>10)
{
digit=number%10;
sum...
this program is supposed to add up the integers in a number entered by a user and print out the sum. i got the easy part down.
if(number<10)
{
sum=number;
}
for the next part i was...
...I just knew it was something simple like that....I feel dumb lol, But thanks man preciate it.
Heres the modified code
System.out.println("Enter an integer:");
Scanner input=new Scanner(System.in);
int number= input.nextInt();
...
Hey thx.. I changed the code a bit since this post... I have decided to use the modulus operator and I still need a bit of help. And yes this problem does require recursion. Heres the problem from...
I need help making a recursive program that computes the number of odd digits in a number. This is as far as I have gotten.
public class ComputeOddNumbers {
/**
* @param args the...
Hey everybody whats goin on. Im a starter java programmer and I have been doing this for a year. Im tryna learn more about programming and i came to this site cuz i need some help. Stay creative guys...