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.
Basic
C program to perform input output of all basic data types
Write a C program to demonstrate input and output of all basic and derived types. How to use scanf()
and printf()
function perform input and output on primitive types in C programming.
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.
C program to convert days to years weeks and days
Write a C program to input number of days from user and convert it to years, weeks and days. How to convert days to years, weeks in C programming. Logic to convert days to years, weeks and days in C program.
Input
Enter days: 373
Output
373 days = 1 year/s, 1 week/s and 1 day/s
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.
Input
Temperature in fahrenheit = 205
Output
Temperature in celsius = 96.11 C
C program to calculate Compound Interest
Write a C program to input principle (amount), time and rate (P, T, R) and find Compound Interest. How to calculate compound interest in C programming. Logic to calculate compound interest in C program.
Input
Enter principle (amount): 1200 Enter time: 2 Enter rate: 5.4
Output
Compound Interest = 1333.099243
C program to calculate Simple Interest
Write a C program to input principle, time and rate (P, T, R) from user and find Simple Interest. How to calculate simple interest in C programming. Logic to find simple interest in C program.
Input
Enter principle: 1200 Enter time: 2 Enter rate: 5.4
Output
Simple Interest = 129.600006
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.
Input
Enter marks of five subjects: 95 76 85 90 89
Output
Total = 435 Average = 87 Percentage = 87.00
C program to find square root of a number
Write a C program to input a number and find square root of the given number. How to find square root of a number in C programming using inbuilt sqrt()
function. How to use predefined sqrt()
function to find square root in C program.
Input
Enter any number: 9
Output
Square root of 9 = 3
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.
Input
Enter side of the equilateral triangle: 10
Output
Area of equilateral triangle = 43.3 sq. units