QBPIC
QBPIC
Step 1: Start
A do-while loop is an exit-controlled loop, meaning it executes at least once before checking
the condition.
Syntax:
do {
// Code to execute
} while(condition);
Example:
#include <stdio.h>
int main() {
int i = 1;
do {
return 0;
3)Describe the following terms : (i) Keyword (ii) Identifier (iii) Variable (iv) Constant
(i) Keyword: Reserved words in C that have special meanings (e.g., int, return, while).
(ii) Identifier: Name used to identify variables, functions, etc. (e.g., age, sum).
(iii) Variable: Named storage that holds values which can change during execution (e.g., int x
= 10;).
(iv) Constant: A fixed value that doesn’t change during program execution (e.g., #define PI
3.14 or const int x = 5;).
#include <stdio.h>
int main() {
int a, b, c;
else
return 0;
}
5) Explain Go-to statement with example
Example:
#include <stdio.h>
int main() {
int num;
scanf("%d", &num);
if (num < 0)
goto negative;
return 0;
negative:
return 0;
6) Explain any two math function with syntax and give example of each.
Example:
#include <stdio.h>
#include <math.h>
int main() {
return 0;
Example:
#include <stdio.h>
#include <math.h>
int main() {
return 0;
Header files in C are files that contain function declarations, macro definitions, and constants,
which can be used in multiple source files. They allow code reusability and modular
programming by separating function definitions from their declarations.
Example:
#include <stdio.h>
int main() {
int num;
scanf("%d", &num);
if (num > 0) {
if (num % 2 == 0)
else
} else {
return 0;
#include <stdio.h>
int main() {
if (i == 3)
return 0;
#include <stdio.h>
int main() {
if (i == 3)
break;
return 0;
10) Write a program to add, subtract, multiply and divide two numbers, accepted from user using
switch case.
#include <stdio.h>
int main() {
int num1, num2, choice;
scanf("%d", &choice);
switch (choice) {
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
if (num2 != 0)
else
break;
default:
printf("Invalid choice");
}
return 0;