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.

Example
Input

Enter days: 373

Output

373 days = 1 year/s, 1 week/s and 1 day/s

Read more

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

Read more

C program to print fibonacci series upto n terms

Write a C program to print Fibonacci series up to n terms using loop. How to generate Fibonacci series up to n terms using loops in C programming. Logic to print Fibonacci series in a given range in C programming.

Example

Input

Input number of terms: 10

Output

Fibonacci series: 
0, 1, 1, 2, 3, 5, 8, 13, 21, 34

Read more

If else programming exercises and solutions in C

if...else is a branching statement. It is used to take an action based on some condition. For example – if user inputs valid account number and pin, then allow money withdrawal.

If statement works like “If condition is met, then execute the task”. It is used to compare things and take some action based on the comparison. Relational and logical operators supports this comparison.

Read more

C program to calculate electricity bill

Write a C program to input electricity unit charge and calculate the total electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill.

How to calculate electricity bill using if else in C programming. Program to find electricity bill using if else in C. Logic to find net electricity bill in C program.

Read more

C program to enter basic salary and calculate gross salary of an employee

Write a C program to input basic salary of an employee and calculate gross salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%

How to calculate gross salary of an employee using if else in C programming. Program to calculate gross salary of an employee using if else in C program. Logic to find gross salary of employee in C program.

Example
Input

Input basic salary of an employee: 22000

Output

Gross salary = 44000

Read more

C program to enter student marks and find percentage and grade

Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer, calculate percentage and grade according to given conditions:
If percentage >= 90% : Grade A
If percentage >= 80% : Grade B
If percentage >= 70% : Grade C
If percentage >= 60% : Grade D
If percentage >= 40% : Grade E
If percentage < 40% : Grade F

Example
Input

Input marks of five subjects: 95
95
97
98
90

Output

Percentage = 95.00 
Grade A

Read more

C program to calculate profit or loss

Write a C program to input cost price and selling price of a product and check profit or loss. Also calculate total profit or loss using if else. How to calculate profit or loss on any product using if else in C programming. Program to calculate profit and loss of any product in C.

Example
Input

Input cost price: 1000
Input selling price: 1500

Output

Profit: 500

Read more

C program to check whether a number is divisible by 5 and 11 or not

Write a C program to check whether a number is divisible by 5 and 11 or not using if else. How to check divisibility of any number in C programming. C program to enter any number and check whether it is divisible by 5 and 11 or not. Logic to check divisibility of a number in C program.

Example
Input

Input number: 55

Output

Number is divisible by 5 and 11

Read more

C program to find maximum between three numbers

Write a C program to find maximum between three numbers using ladder if else or nested if. How to find maximum or minimum between three numbers using if else in C programming. Logic to find maximum or minimum between three numbers in C program.

Example
Input

Input num1: 10
Input num2: 20
Input num3: 15

Output

Maximum is: 20

Read more