C program to check Leap Year

Write a C program to check leap year using if else. How to check whether a given year is leap year or not in C programming. C Program to input year from user and check whether the given year is leap year or not using ladder if else. Logic to check leap year in C programming.

Example
Input

Input year: 2004

Output

2004 is leap year.

Read more

C program check whether a number is even or odd

Write a C program to check whether a number is even or odd using if else. How to check whether a number is even or odd using if else in C program. C Program to input a number from user and check whether the given number is even or odd. Logic to check even and … Read more

C program to find maximum between two numbers

Write a C program to find maximum between two numbers using if else. C program to input two numbers from user and find maximum between two numbers using if else. How to find maximum or minimum between two numbers using if else in C programming.

Example
Input

Input num1: 10
Input num2: 20

Output

Maximum = 20

Read more

Basic programming exercises and solutions in C

C programming is a stepping stone for many programmers in the programming world. C is best to learn internals of programming and know how a computer program works internally.

Since it is close to low level programming. Programming in C can be a nightmare for beginners if not practiced properly. However, you can learn and practice at Codeforwin step by step.

In this programming exercise we will focus on basics of C programming. After completing this exercise you will learn basic structure and semantics of a C program and how to write mathematical programs in C.

Read more

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.

Example
Input

Enter principle (amount): 1200
Enter time: 2
Enter rate: 5.4

Output

Compound Interest = 1333.099243

Read more

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.

Example
Input

Enter principle: 1200
Enter time: 2
Enter rate: 5.4

Output

Simple Interest = 129.600006

Read more

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

Read more

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.

Example
Input

Enter any number: 9

Output

Square root of 9 = 3

Read more

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

Read more

C program to find area of a triangle

Write a C program to input base and height of a triangle and find area of the given triangle. How to find area of a triangle in C programming. Logic to find area of a triangle in C program.

Example
Input

Enter base of the triangle: 10
Enter height of the triangle: 15

Output

Area of the triangle = 75 sq. units

Read more