Tag Archives: Basic

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

How to find range of data types in C programming?

In C programming data types play a major role, so is their size and range. The sizeof() operator gives you bytes required to store value of some type in memory. However, in programming you must be aware of range of a type to avoid overflow and underflow errors.

The size of a data type is compiler dependent and so is its range. So, you must not hardcode size and range values in your program.

There are two ways to find minimum and maximum range of a type. You can use any of the approach to get range of a type.

Continue reading How to find range of data types in C programming?

C program to convert temperature from degree fahrenheit to celsius

Write a C program to input temperature in degree Fahrenheit and convert it to degree Centigrade. How to convert temperature from Fahrenheit to Celsius in C programming. C program for temperature conversion. Logic to convert temperature from Fahrenheit to Celsius in C program.

Example
Input

Temperature in fahrenheit = 205

Output

Temperature in celsius = 96.11 C

Continue reading C program to convert temperature from degree fahrenheit to celsius

C program to calculate total average and percentage of five subjects

Write a C program to input marks of five subjects of a student and calculate total, average and percentage of all subjects. How to calculate total, average and percentage in C programming. Logic to find total, average and percentage in C program.

Example
Input

Enter marks of five subjects: 95 76 85 90 89

Output

Total = 435
Average = 87
Percentage = 87.00

Continue reading C program to calculate total average and percentage of five subjects

C program to find area of an equilateral triangle

Write a C program to input side of an equilateral triangle from user and find area of the given triangle. How to find area of an equilateral triangle in C programming. C program to calculate area of an equilateral triangle if its side is given.

Example

Input

Enter side of the equilateral triangle: 10

Output

Area of equilateral triangle = 43.3 sq. units

Continue reading C program to find area of an equilateral triangle