You are on page 1of 7

APPOLLO NATIONAL PUBLIC SCHOOL

Class IX
COMPUTER APPLICATIONS 2020-2021

ICSE KA 083

Note : Solution for the remaining programs .Write it in the C.W .

14. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int num;
float f,f1;
System.out.println("Input a decimal number");
f=sc.nextFloat();
num=(int)(num*100+0.5f);
f1=num/100;
System.out.println("Rounded off ="+num);
}
}

15. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,temp;
System.out.println("Enter two numbers");
a=sc.nextInt();
b=sc.nextInt();
System.out.println("value of a = "+a +" and b = "+b +" before swap");
temp=a;
a=b;
b=temp;
System.out.println("value of a = "+a+" and b = "+b +" after swap");
}
}

16. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int hr,min,sec,s;
System.out.println("Input the time in hours");
hr=sc.nextInt();
System.out.println("Input the time in minutes");
min=sc.nextInt();
System.out.println("Input the time in seconds");
s=sc.nextInt();
sec= hr*3600+min*60+s;
System.out.println("Time in seconds = "+sec);
}
}
17. import java.util.*;
class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n1,n2,n3,sum=0;
System.out.println("Input any three numbers");
n1=sc.nextInt();
n2=sc.nextInt();
n3=sc.nextInt();
sum= n1-(-n2)-(-n3);
System.out.println("Sum = "+sum);

}
}

18. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int s,per,area;
System.out.println("Input the perimeter of a square");
per=sc.nextInt();
s=per/4;
area=s*s;
System.out.println("Area = "+area);
}
}

19. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int l,b,per,area;
System.out.println("Input the length of the rectangle");
l=sc.nextInt();
System.out.println("Input the area of a rectangle");
area=sc.nextInt();
b=area/l;
per=2*(l+b);
System.out.println("Perimeter = "+per);
}
}

20. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
double bp,da,hra,pf,np,gp;
System.out.println("Input the basic pay");
bp=sc.nextDouble();
hra=(bp*15)/100;
da=(bp*25)/100;
pf=(bp*8.33)/100;
np=bp+da+hra;
gp=np-pf;
System.out.println("The gross pay of the employee is = "+gp);
}
}

21. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int l,b,pr,s,ar=0;
System.out.println("Input the length and breadth of the rectangle");
l=sc.nextInt();
b=sc.nextInt();
pr=2*(l+b);
s=pr/4;
ar=s*s;
System.out.println("Area of the square = "+ar);
}
}

22. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int num,res;
System.out.println("Input any number");
num=sc.nextInt();
res=-num;
System.out.println("Sign Changed = "+res);
}
}

23. import java.util.*;


class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
double m1,m2,m3,m4,m5,agg,per;
System.out.println("Enter the marks obtained in 5 subjects");
m1=sc.nextDouble();
m2=sc.nextDouble();
m3=sc.nextDouble();
m4=sc.nextDouble();
m5=sc.nextDouble();
agg=m1+m2+m3+m4+m5;
per=agg/500*100;
System.out.println("Aggregate = "+agg);
System.out.println("Percentage = "+per);
}
}
25. import java.util.*;
class Input
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
double sp,tcp,cp,pr;
System.out.println("Enter the total selling PRICE");
sp=sc.nextDouble();
System.out.println("Enter the profit");
pr=sc.nextDouble();
tcp=sp-pr;//Total cost price
cp=tcp/15; //Cost price of one item
System.out.println("cost price of one item = "+cp);

}
}

You might also like