I just need only these more answers :D
Attachments:
Answers
Answered by
2
Answer:-
These are the required programs.
Question 23.
Series given:-
1 3 9 27
Logic:-
1=3^0
3=3¹
9=3²
27=3³
So, the series is in the form of 3ⁿ
This is the program.
class Series
{
public static void main(String args[])
{
int a=1;
for(int i=0;i<10;i++)
{
System.out.print(a+" ");
a=a*3;
}
}
}
Question 24.
import java.util.*;
class Price
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the amount of purchase: ");
double a=sc.nextDouble();
double d;
if(a<=1000)
d=0;
else if(a<=5000)
d=5*a/100.0;
else if(a<=10000)
d=10*a/100.0;
else
d=15*a/100;
a=a-d;
System.out.println("Payable amount: "+a);
}
}
Similar questions
Chemistry,
2 months ago
Math,
2 months ago
English,
10 months ago
Geography,
10 months ago
Social Sciences,
10 months ago