Write a menu driven the program in java to display the following pattern/ series using conditional statements:
i) 1 3 1 5 3 1 7 5 3 1 9 7 5 3 1
ii) S = (2/a) + (3/a2) + (5/a3) + (7/a4) + ....... to n
Answers
Answered by
0
Answer:
vshejsnwb
Explanation:
abbehsjsllababsmlshsbdndkzxcgsgknklgewascmngfcvlolololollolololo
Answered by
0
1
3 THESE ARE ODD NUMBERS.
5
7
9
it is like
1,3
1,5,3
1,7,5,3
1,9,7,5,3
understand?
now make a code for this :)
The second subquestion:
public class Series {
public static float Sum(int a, int n)
{
float sum = 0;
for (int i = 1; i <= n; ++i)
{
sum += (i / Math.pow(a, i));
}
return sum;
}
public static void main(String[] args)
{
int a = 3, n = 3;
System.out.println(Sum(a, n));
}
}
Similar questions