0% found this document useful (0 votes)
5 views3 pages

Java Practical Exercises

This document contains Java practical exercises conducted by students under the guidance of teacher Sir Zekria Sediqi. It includes various programming tasks such as arithmetic operations, user input handling, and basic mathematical functions. The exercises aim to reinforce fundamental programming concepts through hands-on coding.

Uploaded by

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

Java Practical Exercises

This document contains Java practical exercises conducted by students under the guidance of teacher Sir Zekria Sediqi. It includes various programming tasks such as arithmetic operations, user input handling, and basic mathematical functions. The exercises aim to reinforce fundamental programming concepts through hands-on coding.

Uploaded by

raminfatahi1000
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Participants in this Practice

Ramin Fatahi
Mujeebullah Outmankhel
Sayed Fazelul Rahim Sadat
Emal Amin

Java Practical Exercises

Teacher : sir Zekria Sediqi

Subject : Fundamentals of Programing


import [Link];
public class Main {
// first question
public static void main(String[] args) {
Scanner input=new Scanner([Link]);
// second question
int a;
int b;
a=10;
b=20;
[Link]("this is the sum of a and b :"+(a+b));
[Link]("this is the multiplication of a and b :"+(a*b));
// third question
int a1=10;
int b1=5;
[Link]("Sum = "+(a1+b1));
[Link]("Div = "+(a1/b1));
// forth question
[Link]("Enter your first number : ");
int n1=[Link]();
[Link]("Enter your second number : ");
int n2=[Link]();
[Link] ("this is the sum of your numbers: " );
[Link](n1+n2);
[Link] ("this is the subscibtion of your numbers: ");
[Link]( n1-n2);
//fifth question
[Link]("enter the number:");
int num=[Link]();
[Link]("this is the number you given"+num);
//sixth question
[Link]("enter your number then i will give you sqrt.");
int r=[Link]();
[Link] ("this is the sqrt of your number: ");
[Link]([Link](r));
// seventh question
double x=2;
double result=[Link](x,3);
[Link](result);
//Eighth question
[Link]("Enter your first number for camparison");
int F1=[Link]();
[Link]("Enter your second number for comparison");
int F2=[Link]();
[Link](F1>F2);
[Link](F1>0&&F2>0);

//ninth question
int a2=10,b2=20,c2=30;
double avg=(a2+b2+c2)/3;
[Link]("Avarage="+avg);
//tenth question
[Link]("Enter your age: ");
int age=[Link]();
int current_year=2026;
int birthyear=current_year-age;

[Link]("your birth year is "+birthyear);


//Eleventh question
[Link]("What is your name : ");
String name=[Link]();
[Link]("Enter yur birth year: ");
int birth_year=[Link]();
int currentyear=2026;
int age1=currentyear-birth_year;
[Link]("Hello, "+name+" you are "+age1+"years old.");

}
}

You might also like