Solved 10 Marks Exam Questions
Solved 10 Marks Exam Questions
getchar() is a standard library function in C used to read a single character from the standard input
(stdin).
It waits until the user presses a key and then reads that character.
Example:
```c
#include<stdio.h>
int main() {
char c;
c = getchar();
return 0;
```
A control string is part of the syntax of functions like printf and scanf that defines the format for
input/output.
Example:
In printf("Hello %d", 5); the control string is "Hello %d" where %d specifies an integer placeholder.
The if-else ladder is used when multiple conditions need to be checked sequentially.
Syntax:
```c
if (condition1) {
// Code block 1
} else if (condition2) {
// Code block 2
} else {
```
Syntax:
```c
if (condition) {
} else {
```
```c
#include<stdio.h>
int main() {
int a, b, c;
printf("Valid Triangle\n");
// Determine type
printf("Equilateral\n");
printf("Isosceles\n");
else
printf("Scalene\n");
} else {
printf("Invalid Triangle\n");
return 0;
```