Java program to convert centimeter to inch, meter and kilometer

Quick links

Write a Java program to input centimeter and convert to inch, meter and kilometer. How to convert centimeter to inch, meter and kilometer in Java programming.

Example
Input

Enter centimeter : 12.5

Output

12.5 cm is equal to 4.925 inch.
12.5 cm is equal to 0.125 meter.
12.5 cm is equal to 4.925 kilometer.

Continue reading Java program to convert centimeter to inch, meter and kilometer

Java program to find diameter, circumference and area of circle

Quick links

In this exercise, we will learn to find diameter, circumference and area of circle. Write a Java program to input radius of circle and find diameter, circumference and area of circle.

Example
Input

Enter radius of circle : 6

Output

Diameter of circle is : 20
Circumference of circle is : 62.8318
Area of circle is : 314.159

Continue reading Java program to find diameter, circumference and area of circle

Unions in C programming language, need and use

Unions in C are user defined data type similar to structures. Union allows to define multiple members of different type at single location. In this article I will explain what is union, need of union, how to declare, define and access unions in C programming language.

Continue reading Unions in C programming language, need and use

C program to delete element from circular linked list

Write a C program to delete element from circular linked list by key. In this article I will explain how to delete by key element from circular linked list. I will explain logic and program to delete element from circular linked list by key.

Continue reading C program to delete element from circular linked list

Java program to find perimeter and area of rectangle

Write a Java program to input length and width and find perimeter and area of rectangle. Logic to find perimeter and area of a rectangle, whose length and width are given. In this example we will learn to write basic logical program in Java. We will learn to find perimeter and area of rectangle.

Example
Input

Length of rectangle = 30
Width of rectangle  = 20

Output

Perimeter of rectangle is 100.0 units.
Area of rectangle is 600.0 sq. units.

Continue reading Java program to find perimeter and area of rectangle

Java program to perform all arithmetic operations

Write a Java program to perform all arithmetic operation. How to perform arithmetic operations in Java programming. In this example we will learn to input two integer from user and perform all arithmetic operations.

Example
Input

First number: 15
Second number: 4

Output

Sum : 19
Difference : 11
Product : 60
Quotient : 3
Modulus : 3

Continue reading Java program to perform all arithmetic operations

Basic input using Scanner class in Java

Write a java program to perform basic input using Scanner class. In this article I will explain how to input all basic data types using Scanner class in Java. We will learn how to use java.util.Scanner class to input data from user.

Example
Input

Enter charater value: c
Enter integer value: 10

Output

You entered charater : c
You entered integer: 10

Continue reading Basic input using Scanner class in Java

Hello world program in Java

Programming in Java has always been fun for me. With this post I begin the Java programming tutorials journey. In this post, we will learn how to write a simple Hello world program in Java. We will learn basic structure of a Java program, how to write, compile and execute a Java program.

Continue reading Hello world program in Java