Program based on decision control( if ,else and switch)
Here are the some programs based on the decision control statements like if , else , nested if else and switch statement. I am giving you some program for the practice topic wise .I am also giving you some MCQS questions based on these topics .So after solving these questions your doubts will be clear related to these topic.
C Programs based on decision control (if and else):-
1.Write a C program to find maximum between two numbers.
2.Write a C program to find maximum between three numbers.
3.Write a C program to check whether a number is negative, positive or zero.
4.Write a C program to check whether a number is divisible by 5 and 11 or not.
5.Write a C program to check whether a number is even or odd.
6.Write a C program to check whether a year is leap year or not.
7.Write a C program to check whether a character is alphabet or not.
C Program based on switch case:-
1.Using switch statement Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
2.C Program to find the maximum between two numbers. Using the switch statement
3. C Program to find the maximum between three numbers. Using the switch statement.
4.C Program to check whether a number is divisible by 5 and 11 or not. Using the switch statement.
5.C Program to check whether a year is a leap year or not. Using switch statement
MCQs :-
1) Choose a C Conditional Operator from the list.
A) ?:
B) 😕
C) :<
D) <:
2) What is the other name for C Language ?: Question Mark Colon Operator.?
A) Comparison Operator
B) If-Else Operator
C) Binary Operator
D) Ternary Operator
3) Choose a syntax for C Ternary Operator from the list.
A) condition ? expression1 : expression2
B) condition : expression1 ? expression2
C) condition ? expression1 < expression2
D) condition < expression1 ? expression2
4) What is the output of the C statement.?
int main()
{
int a=0;
a = 5<2 ? 4 : 3;
printf(“%d”,a);
return 0;
}
A) 4
B) 3
C) 5
D) 2
5) What is the output of C Program.?
int main()
{
int a=0;
a = printf(“4”);
printf(“%d”,a);
return 0;
}
A) 04
B) compiler error
C) 40
D) 41
Click on the given links for the questions:-
1)Practice questions based on decision control
2) Practice questions based on loops and functions
3) Practice questions based on array and string and searching , sorting
Recommended Post:
Hackerearth Problems:-
- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem
- Playing With Characters | Hackerrank practice problem solution
- Sum and Difference of Two Numbers | hackerrank practice problem solution
- Functions in C | hackerrank practice problem solution
- Pointers in C | hackerrank practice problem solution
- Conditional Statements in C | Hackerrank practice problem solution
- For Loop in C | hackerrank practice problem solution
Data structure:-
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree
Key points:-
- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier
Must check this:-
MCQs:-