0% found this document useful (0 votes)
20 views4 pages

New Text Document

The document contains the code for 13 questions that perform various calculations and condition checks. It includes calculating areas of shapes, finding sums, billing calculations based on usage amounts, checking for triangle types, printing odd numbers between 1-20, grading based on scores, printing even/odd numbers from 1-10 with labels, printing even numbers from 1-40, calculating a sum from 1-100, checking for leap years, checking for prime numbers, printing odd numbers from 1-20, and printing the Fibonacci sequence from 1-10 with commas.

Uploaded by

Aaditya Nepali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

New Text Document

The document contains the code for 13 questions that perform various calculations and condition checks. It includes calculating areas of shapes, finding sums, billing calculations based on usage amounts, checking for triangle types, printing odd numbers between 1-20, grading based on scores, printing even/odd numbers from 1-10 with labels, printing even numbers from 1-40, calculating a sum from 1-100, checking for leap years, checking for prime numbers, printing odd numbers from 1-20, and printing the Fibonacci sequence from 1-10 with commas.

Uploaded by

Aaditya Nepali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

/**

* Write a description of class briasmaati here.


*
* @author (your name)
* @version (a version number or a date)
*/
public class briasmaati{
public static void main(String[] args){

//Q1
int length = 5;
int breadth = 7;
int height = 10;
int radius = 6;
double pie = (3.14);
System.out.println("area of rectangle =" + length*breadth);
System.out.println("area of square =" + length*length);
System.out.println("area of circle =" + pie*radius*radius);

//Q2
int a = 3;
int b = 5;
int c = a + b;
System.out.println("sum of two numbers =" + c);

//Q3
int x=220;
if (x<=50) {
int y=20/100*x;
int z=x*50/100+y;

System.out.println("billAmount = "+c);
}else if (x>=100 && x<=200) {
int y=20/100*x;
int z=50*50/100;
x=x-50;
int w=x*80/100;
int v=z+w+y;
System.out.println("billAmount =" +v);
}else if (x>200 && x<=300) {
int y=20/100*x;
int z=50*50/100;
x=x-50;
int w=100*80/100;
x=x-100;
int v=x*130/100;
int t=z+w+v+y;
System.out.println("billAmount = "+t);

}else {
int y=20/100*x;
int z=x*170/100+y;
System.out.println("billAmount = "+z);
}

//Q4
int num1=1;
int num2=2;
int num3=3;
if (num1==num2 && num1==num3 && num2==num3){
System.out.println("equilateral");
}else if(num1==num2||num1==num2||num2==num3){
System.out.println("Isosceles triangle");
}else{
System.out.println("scalen");
}

//Q5
for(int i=1;i<=20;i++){
if(i%2==0){
continue;
}
else{
System.out.println(i);
}
}

//Q6
int g=77;
if(g<40){
System.out.println("fail");
}
else if(g>+40 && g<50){
System.out.println("D");
}
else if(g>=50 && g<60){
System.out.println("C");
}
else if(g>=60 && g<80){
System.out.println("B");
}
else if(g>=80 && g<=100){
System.out.println("A");
}

//Q7
for(int j=1;j<=10;j++){
if(j%2==0){
System.out.println(j+"even");
}
else{
System.out.println(j+"odd");
}
}

//Q8
for(int k=1;k<=40;k++){
if(k%2==0){
System.out.println(k);
}
}
//Q9
int l = 0;
int h = 1;

while (h <= 100){


l =l+1;
h++;
}

System.out.println("The sum of all positive integers less than or equal to


100");

//Q10
int year=2000;
if(year % 4 == 0 && (year % 100 !=0 || year == 2000)){
System.out.println("leap year");
}
else{
System.out.println("not leap year");
}

//Q11
int n = 4;
boolean p = true;

for(int r=2; r<=n/2; r++){


if (n % r == 0){
p = false;
break;
}
}

if (p) {
System.out.println(n+ " is a prime number.");
}else {
System.out.println(n+ " is not a primr number.");
}

//Q12
for(int m=1; m<=20; m++){
if(m%2==0){
continue;
}
else{
System.out.println(m);
}
}

//Q13
int q=1;
int s=1;
int u=s;
System.out.println(a+","+b+",");
while(q<=10){
int o=s+u;
System.out.println(c+",");
s=u;
u=o;
q++;
}
}
}

You might also like