write a program in Java to display the following program
Answers
import java.util.*;
class Term_deposit
{
public static void main (String args[])
{
Scanner in = new Scanner(System.in);
{
System.out.println("enter the sum in term deposit scheme");
int p=in.nextInt();
System.out.println("enter the age of the customer");
int age=in.nextInt();
System.out.println("enter the term");
int t =in.nextInt();
double i = in.nextDouble ;
double amtp = int.nextDouble();
{
if ( age < 60)
{
if
{
if(t<=1)
i = p*7.5*t/100;
if (t <=2)
i = p*8.5*t/100;
if (t <=3)
i=p*9.5*t/100;
if(t < 3)
i=p*10.0*t/100;
}
else
{
if ( t <=1)
i = p*8.0*t/100;
if (t <=2)
i = p*9.0*t/100;
If( t <=3)
i=p*10.0*t/100;
If(t< 3)
i=p*11.0*t/100;
}
amtp= p- i;
System.out.println(/t"Amount deposited"/t"Term"/t"Age"/t"Interest"/t"Amount paid"/t);
System.out.println(/t+p+/t+ t +/t+i+/t+amtp/t");
}}}
Answer:
Num=int(input("Enter the max. lines : ")) # This will collected the number of rows needed to make the patten.
num=Num+1 # I did this so that we don't need to add one with the old variable always.
for i in range(1,num):
for j in range(1,num-i):
print(end=" ") # This will print the spaces before the numbers in one line.
for k in range(0,i):
print(i,end=" ") # This will print the numbers in the pattern in one line.
print()