hi all
this is my code
i got an error but unfortunately i can't see it:(
please help me....

public class QUSTION5

{ 
public static void main (String args[]) 
{ 
double n = 20; 
int counter= 0; 

for (int t =0; t<=25; t++) 
{ 
n= (220/(1+10*Math.pow(0.83>,t))); 
System.out.println("At t = " + t + " the value of N = " + n); 

if (n<80)counter++;  

} 
System.out.println("supervision years = " + counter); 
} 
}

Recommended Answers

All 5 Replies

Extra character ">" somehow slipped in the wrong place. The line should be

n= (220/(1+10*Math.pow(0.83,t)));

am still having the same problem :(

this is my code after correcting my mistake

public class QUSTION5

{ 
public static void main (String args[]) 
{ 
double n = 20; 
int counter= 0; 

for (int t =0; t<=25; t++) 
{ 
n= (220/(1+10*Math.pow(0.83,t)));

System.out.println("At t = " + t + " the value of N = " + n); 

if (n<80)counter++;  

} 
System.out.println("supervision years = " + counter); 
} 
}

whats the problem?

This works for me

public class Question5{ 

	public static void main (String args[]) 
	{ 
		double n = 20; 
		int counter= 0; 
		
		for (int t =0; t<=25; t++) 
		{ 
			n= (220/(1+10*Math.pow(0.83,t))); 
			System.out.println("At t = " + t + " the value of N = " + n); 
			
			if (n<80)counter++;  
		
		} 
		System.out.println("supervision years = " + counter); 
	} 
}

output is

At t = 0 the value of N = 20.0
At t = 1 the value of N = 23.655913978494628
At t = 2 the value of N = 27.886931169983523
At t = 3 the value of N = 32.74847533518809
At t = 4 the value of N = 38.288623156948844
At t = 5 the value of N = 44.54306329950969
At t = 6 the value of N = 51.52944385745791
At t = 7 the value of N = 59.24162481935718
At t = 8 the value of N = 67.64459780888309
At t = 9 the value of N = 76.67101285418252
At t = 10 the value of N = 86.22027154835898
At t = 11 the value of N = 96.16093135943517
At t = 12 the value of N = 106.33669668469402
At t = 13 the value of N = 116.57561890382067
At t = 14 the value of N = 126.70145196317215
At t = 15 the value of N = 136.5456170934149
At t = 16 the value of N = 145.95808590331916
At t = 17 the value of N = 154.81574593720234
At t = 18 the value of N = 163.02737805136428
At t = 19 the value of N = 170.5350646915546
At t = 20 the value of N = 177.3124620033929
At t = 21 the value of N = 183.36076818064623
At t = 22 the value of N = 188.70336302007027
At t = 23 the value of N = 193.3800199668549
At t = 24 the value of N = 197.44138623540724
At t = 25 the value of N = 200.94417600497957
supervision years = 10

it works now
thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.