1.#include <stdio.
h>
Int main()
Float num1, num2, sum;
Printf(“Enter first number: “);
Scanf(“%f”, &num1);
Printf(“Enter second number: “);
Scanf(“%f”, &num2);
Sum = num1 + num2;
Printf(“The sum is: %.2f\n”, sum);
return 0;
2.#include <stdio.h>
Int main() {
Float num1, num2, result;
Printf(“Enter first number: “);
Scanf(“%f”, &num1);
Printf(“Enter second number: “);
Scanf(“%f”, &num2);
Result = num1 – num2;
Printf(“The result of subtraction is: %.2f\n”, result);
return 0;
3.#include <stdio.h>
Int main() {
Float num1, num2, result;
Printf(“Enter first number: “);
Scanf(“%f”, &num1);
Printf(“Enter second number: “);
Scanf(“%f”, &num2);
Result = num1 – num2;
Printf(“The result of subtraction is: %.2f\n”, result);
return 0;
4.#include <stdio.h>
Int main()
Float num1, num2, result;
Printf(“Enter first number: “);
Scanf(“%f”, &num1);
Printf(“Enter second number: “);
Scanf(“%f”, &num2);
Result = num1 / num2;
Printf(“The result of division is: %.2f\n”, result);
return 0;
5.#include<stdio.h>
Int main()
{
Int a,b;
Printf(“Enter the first number(dividend):”);
Scanf(“%d”,&a);
Printf(“Enter the second number(divisor):”);
Scanf(“%d”,&b);
Printf(“remainder is:%d\n”,a % b);
return 0;
6.#include <stdio.h>
Int main()
Int a, b, temp;
Printf(“Enter first number: “);
Scanf(“%d”, &a);
Printf(“Enter second number: “);
Scanf(“%d”, &b);
Printf(“Before swapping: a = %d, b = %d\n”, a, b);
Temp = a;
A = b;
B = temp;
Printf(“After swapping: a = %d, b = %d\n”, a, b);
return 0;
7.
#include <stdio.h>
Int main() {
Int a, b;
Printf(“Enter first number: “);
Scanf(“%d”, &a);
Printf(“Enter second number: “);
Scanf(“%d”, &b);
Printf(“Before swapping: a = %d, b = %d\n”, a, b);
A = a + b;
B = a – b;
A = a – b;
Printf(“After swapping: a = %d, b = %d\n”, a, b);
return 0;
8.
#include <stdio.h>
Int main() {
Float a, b,c,average;
Printf(“Enter first number: “);
Scanf(“%d”, &a);
Printf(“Enter second number: “);
Scanf(“%d”, &b);
Printf(“Enter the third number:”);
Scanf(“%d”, &c);
Average=(a+b+c)/3;
Printf(“the average is:%.2d\n”,average);
return 0;
}
9.#include <stdio.h>
Int main() {
Int length, width, area, perimeter;
Printf(“Enter length: “);
Scanf(“%d”, &length);
Printf(“Enter width: “);
Scanf(“%d”, &width);
Area = length * width;
Perimeter = 2 * (length + width);
Printf(“Area = %d\n”, area);
Printf(“Perimeter = %d\n”, perimeter);
return 0;
10.10.#include <stdio.h>int main()
Float principal, rate, time, interest;
Printf(“Enter principal amount: “);
Scanf(“%f”, &principal);
Printf(“Enter rate of interest: “);
Scanf(“%f”, &rate);
Printf(“Enter time (in years): “);
Scanf(“%f”, &time);
Interest = (principal * rate * time) / 100;
Printf(“Simple Interest = %.2f\n”, interest);
return 0;
11.#include <stdio.h>
Int main() {
Float principal, rate, time, amount;
Printf(“Enter principal: “);
Scanf(“%f”, &principal);
Printf(“Enter rate (percent): “);
Scanf(“%f”, &rate);
Printf(“Enter time (years): “);
Scanf(“%f”, &time);
Amount = principal;
For (int I = 0; I < time; i++) {
Amount = amount * (1 + rate / 100);
Printf(“Compound Interest = %.2f\n”, amount – principal);
Printf(“Total Amount = %.2f\n”, amount);
return 0;
12.#include <stdio.h>
#include <math.h>
Int main() {
Float num, squareRoot, cube;
Printf(“Enter a number: “);
Scanf(“%f”, &num);
squareRoot = sqrt(num);
cube = num * num * num;
printf(“Square root of %.2f = %.2f\n”, num, squareRoot);
printf(“Cube of %.2f = %.2f\n”, num, cube);
return 0;
13.#include <stdio.h>
Int main() {
Float celsius, fahrenheit;
Printf(“Enter temperature in Celsius: “);
Scanf(“%f”, &celsius);
Fahrenheit = (celsius * 9 / 5) + 32;
Printf(“Temperature in Fahrenheit: %.2f\n”, fahrenheit);
return 0;
14.#include <stdio.h>
Int main() {
Float fahrenheit, celsius;
Printf(“Enter temperature in Fahrenheit: “);
Scanf(“%f”, &fahrenheit);
Celsius = (fahrenheit – 32) * 5 / 9;
Printf(“Temperature in Celsius: %.2f\n”, celsius);
return 0;
}
15.#include <stdio.h>
Int main() {
Int number;
Printf(“Enter an integer: “);
Scanf(“%d”, &number);
If (number % 2 == 0) {
Printf(“%d is even.\n”, number);
} else {
Printf(“%d is odd.\n”, number);
return 0;
16.#include <stdio.h>
Int main() {
Int num;
Printf(“Enter a number: “);
Scanf(“%d”, &num);
Printf(“After increment: %d\n”, ++num);
Printf(“After decrement: %d\n”, --num);
return 0;
17.#include <stdio.h>
Int main() {
Int num = 10;
Printf(“Initial value: %d\n”, num);
Num += 5;
Printf(“After += 5: %d\n”, num);
Num -= 3;
Printf(“After -= 3: %d\n”, num);
Num *= 2;
Printf(“After *= 2: %d\n”, num);
Num /= 4;
Printf(“After /= 4: %d\n”, num);
Num %= 3;
Printf(“After %%= 3: %d\n”, num);
return 0;
18.#include <stdio.h>
Int main() {
Int a = 5, b = 10;
Printf(“a = %d, b = %d\n\n”, a, b);
Printf(“a > b = %d\n”, a > b);
Printf(“a < b = %d\n”, a < b);
Printf(“a == b = %d\n”, a == b);
Printf(“a != b = %d\n”, a != b);
Printf(“a >= b = %d\n”, a >= b);
Printf(“a <= b = %d\n”, a <= b);
return 0;
}
19.#include <stdio.h>
Int main() {
Int a = 1, b = 0;
Printf(“a = %d, b = %d\n\n”, a, b);
Printf(“a && b = %d\n”, a && b);
Printf(“a || b = %d\n”, a || b);
Printf(“!a = %d\n”, !a);
return 0;
20.#include <stdio.h>
Int main() {
Int marks1, marks2, marks3;
Int total;
Float percentage;
Printf(“Enter marks for 3 subjects (out of 100):\n”);
Scanf(“%d %d %d”, &marks1, &marks2 , &marks3);
Total = marks1 + marks2 + marks3;
Percentage = (total / 300.0) * 100;
Printf(“Total Marks = %d\n”, total);
Printf(“Percentage = %.2f%%\n”, percentage);
return 0;