1-7 Lab
1-7 Lab
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()
float per;
scanf("%d",&BEE);
scanf("%d",&PPS);
scanf("%d",&PHYSICS);
scanf("%d",&MATHS);
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()
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);
ci = a - p;
printf("\nCompound Interest=%f",ci);
OUTPUT:
PROGRAM - 3
#include <stdio.h>
#define PI 3.14159
int main() {
scanf("%f", &radius);
circumference = 2 * PI * radius;
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() {
scanf("%f", &celsius);
return 0;
OUTPUT:
PROGRAM - 5
#include <stdio.h>
int main() {
scanf("%d", &num1);
scanf("%d", &num2);
temp = num1;
num1 = num2;
num2 = temp;
printf("\nAfter swapping:\n");
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() {
scanf("%d", &num1);
scanf("%d", &num2);
if (num1 == num2) {
else {
return 0;
OUTPUT:
PROGRAM - 7
#include <stdio.h>
int main() {
scanf("%d", &num1);
scanf("%d", &num2);
scanf("%d", &num3);
greatest = num1;
greatest = num2;
greatest = num3;
return 0;
OUTPUT: