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

C Programming Lab 1

The document outlines a series of programming experiments for a Java programming lab, each with a specific problem definition and sample input/output. Experiments include tasks such as addition of two numbers, calculating the area of a circle, determining odd/even numbers, and checking leap years. Each experiment provides clear instructions for writing a program to solve the respective problem.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

C Programming Lab 1

The document outlines a series of programming experiments for a Java programming lab, each with a specific problem definition and sample input/output. Experiments include tasks such as addition of two numbers, calculating the area of a circle, determining odd/even numbers, and checking leap years. Each experiment provides clear instructions for writing a program to solve the respective problem.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAVA PROGRAMMING LAB 1

Experiment 1: Addition of Two Numbers


Problem Definition: Write a program to read two integer numbers and find
their sum.
Sample Input:
10
20
Sample Output:
Sum = 30

Experiment 2: Area of a Circle


Problem Definition: Write a program to read the radius of a circle and
calculate its area.
Sample Input:
5
Sample Output:
Area = 78.50

Experiment 3: Odd or Even Number


Problem Definition: Write a program to read an integer and determine
whether it is odd or even.
Sample Input:
25
Sample Output:
Odd Number

Experiment 4: Largest of Two Numbers


Problem Definition: Write a program to read two numbers and find the larger
number.
Sample Input:
15
28
Sample Output:
Largest Number = 28

Experiment 5: Swap Two Numbers


Problem Definition: Write a program to interchange the values of two
numbers.
Sample Input:
10
20
Sample Output:
After Swapping: First Number = 20, Second Number = 10

Experiment 6: Simple Interest


Problem Definition: Write a program to calculate Simple Interest.
Sample Input:
10000
5
2
Sample Output:
Simple Interest = 1000.00

Experiment 7: Perimeter of a Rectangle


Problem Definition: Write a program to find the perimeter of a rectangle.
Sample Input:
10
5
Sample Output:
Perimeter = 30

Experiment 8: Positive, Negative or Zero


Problem Definition: Write a program to determine whether a number is
positive, negative, or zero.
Sample Input:
-15
Sample Output:
Negative Number

Experiment 9: Celsius to Fahrenheit Conversion


Problem Definition: Write a program to convert temperature from Celsius to
Fahrenheit.
Sample Input:
25
Sample Output:
Fahrenheit = 77.00

Experiment 10: Multiplication Table


Problem Definition: Write a program to display the multiplication table of a
given number up to 10.
Sample Input:
5
Sample Output:
5 x 1 = 5 ... 5 x 10 = 50

Experiment 11: Sum of First N Natural Numbers


Problem Definition: Write a program to find the sum of the first N natural
numbers.
Sample Input:
10
Sample Output:
Sum = 55

Experiment 12: Check Leap Year


Problem Definition: Write a program to determine whether a given year is a
leap year.
Sample Input:
2024
Sample Output:
Leap Year

You might also like