0% found this document useful (0 votes)
15 views8 pages

1-7 Lab

Lab practical pps

Uploaded by

jacky421421z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

1-7 Lab

Lab practical pps

Uploaded by

jacky421421z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

PROGRAM - 1

AIM: WAP that accepts the marks of 5 subjects and finds the sum and percentage
marks obtained by the student.

CODE:

#include<stdio.h>

void main()

int BEE, PPS,PHYSICS,MATHS,EVS,sum ;

float per;

printf("Enter marks of BEE=");

scanf("%d",&BEE);

printf("Enter marks of PPS=");

scanf("%d",&PPS);

printf("Enter marks of PHYSICS=");

scanf("%d",&PHYSICS);

printf("Enter marks of MATHS=");

scanf("%d",&MATHS);

printf("Enter marks of EVS=");

scanf("%d",&EVS);

sum=BEE+PPS+PHYSICS+MATHS+EVS;

printf("Sum of marks=%d",sum);

per=(float)sum/5;

printf("\nPercentage of marks=%f",per);

}
OUTPUT:
PROGRAM - 2

AIM: WAP that calculates the Simple Interest and Compound Interest. The Principal,
Amount, Rate of Interest and Time are entered through the keyboard.

CODE:

#include<stdio.h>

#include<math.h>

void main()

float p, r, t, a, si, ci;

printf("Enter Principle=");

scanf("%f",&p);

printf("Enter Rate=");

scanf("%f",&r);

printf("Enter Time=");

scanf("%f",&t);

si=(p*r*t)/100;

printf("Simple Interest=%f",si);

a = p*(pow((1 + r / 100), t));

ci = a - p;

printf("\nCompound Interest=%f",ci);

OUTPUT:
PROGRAM - 3

AIM: WAP to calculate the area and circumference of a circle.


CODE:

#include <stdio.h>

#define PI 3.14159

int main() {

float radius, area, circumference;

// Accept input for radius

printf("Enter the radius of the circle: ");

scanf("%f", &radius);

// Calculate area and circumference

area = PI * radius * radius;

circumference = 2 * PI * radius;

// Display area and circumference

printf("\nArea of the circle = %.2f\n", area);

printf("Circumference of the circle = %.2f\n", circumference);

return 0;

OUTPUT:
PROGRAM - 4

AIM: WAP that accepts the temperature in Centigrade and converts into Fahrenheit using
the formula C/5=(F-32)/9

CODE:

#include <stdio.h>

int main() {

float celsius, fahrenheit;

// Accept input for temperature in Celsius

printf("Enter the temperature in Celsius: ");

scanf("%f", &celsius);

// Calculate temperature in Fahrenheit

fahrenheit = (celsius * 9.0 / 5.0) + 32.0;

// Display temperature in Fahrenheit

printf("\nTemperature in Fahrenheit = %.2f\n", fahrenheit);

return 0;

OUTPUT:
PROGRAM - 5

AIM: WAP that swaps values of two variables.


CODE:

#include <stdio.h>

int main() {

int num1, num2, temp;

// Accept input for num1 and num2

printf("Enter the value of num1: ");

scanf("%d", &num1);

printf("Enter the value of num2: ");

scanf("%d", &num2);

// Swap values using a third variable

temp = num1;

num1 = num2;

num2 = temp;

// Display swapped values

printf("\nAfter swapping:\n");

printf("num1 = %d\n", num1);

printf("num2 = %d\n", num2);

return 0;

OUTPUT:
PROGRAM - 6

AIM: WAP that checks whether the two numbers entered by the user are
equal or not.
CODE:

#include <stdio.h>

int main() {

int num1, num2;

// Accept input for num1 and num2

printf("Enter the first number: ");

scanf("%d", &num1);

printf("Enter the second number: ");

scanf("%d", &num2);

// Check if num1 and num2 are equal

if (num1 == num2) {

printf("\nThe two numbers are equal.\n");

else {

printf("\nThe two numbers are not equal.\n");

return 0;

OUTPUT:
PROGRAM - 7

AIM: WAP to find the greatest of three numbers.


CODE:

#include <stdio.h>

int main() {

int num1, num2, num3, greatest;

// Accept input for num1, num2, and num3

printf("Enter the first number: ");

scanf("%d", &num1);

printf("Enter the second number: ");

scanf("%d", &num2);

printf("Enter the third number: ");

scanf("%d", &num3);

// Find the greatest number

greatest = num1;

if (num2 > greatest) {

greatest = num2;

if (num3 > greatest) {

greatest = num3;

// Display the greatest number

printf("\nThe greatest number is: %d\n", greatest);

return 0;

OUTPUT:

You might also like