# Tag Archives: If else

## 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

## 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`

## 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`

## 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`

## C program to check whether triangle is equilateral, scalene or isosceles

Write a C program to input sides of a triangle and check whether a triangle is equilateral, scalene or isosceles triangle using if else. How to check whether a triangle is equilateral, scalene or isosceles triangle in C programming. Logic to classify triangles as equilateral, scalene or isosceles triangle if sides are given in C program.

Example
Input

```Input first side: 30
Input second side: 30
Input third side: 30```

Output

`Triangle is equilateral triangle`

## C program to check whether triangle is valid or not if sides are given

Write a C program to input side of a triangle and check whether triangle is valid or not using if else. How to check whether a triangle can be formed or not if sides of triangle is given using if else in C programming. Logic to check triangle validity if sides are given in C program.

Example
Input

```Input first side: 7
Input second side: 10
Input third side: 5```

Output

`Triangle is valid`

## C program to check whether triangle is valid or not if angles are given

Write a C program to check whether a triangle is valid or not if angles are given using if else. How to check whether a triangle can be formed or not, if its angles are given using if else in C programming. Logic to check triangle validity if angles are given in C program.

Example
Input

```Input first angle: 60
Input second angle: 30
Input third angle: 90```

Output

`The triangle is valid`

## C program to find number of days in month

Write a C program to enter month number between(1-12) and print number of days in month using if else. How to print number of days in a given month using if else in C programming. Logic to find number of days in a month in C program.

Example
Input

`Enter month number: 1`

Output

`It contains 31 days.`

## C program to enter week number and print day of week

Write a C program to input week number(1-7) and print the corresponding day of week name using if else. How to print day of week using if else in C programming. Logic to convert week number to day of week in C programming.

Example
Input

`Input week number: 1`

Output

`Monday`

## C program to check whether a character is alphabet, digit or special character

Write a C program to input a character from user and check whether given character is alphabet, digit or special character using if else. How to check if a character is alphabet, digits or any other special character using if else in C programming. Logic to check alphabet, digit or special character in C programming.

Example
Input

`Input any character: 3`

Output

`3 is digit`