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

CSE Lab Report Final

The document contains a collection of C programming experiments, each with a problem statement, source code, and example output. It includes programs for printing messages, calculating sums and averages, determining areas and circumferences of circles, finding factorials, checking leap years, and identifying even or odd numbers. Each experiment is numbered and provides clear instructions and expected results.

Uploaded by

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

CSE Lab Report Final

The document contains a collection of C programming experiments, each with a problem statement, source code, and example output. It includes programs for printing messages, calculating sums and averages, determining areas and circumferences of circles, finding factorials, checking leap years, and identifying even or odd numbers. Each experiment is numbered and provides clear instructions and expected results.

Uploaded by

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

CONTENTS

SL
Name of Experiments Page NO
NO

01 A C program to print “This is my first C program” 01

A C program to find the Sum and average of three


02
numbers

A C program to calculate the area and circumference


03
of a circle

04 A C program to find the factorial of a given number

05 A C program to calculate a year is leap year or not

06 A C program to calculate a number is even or odd

07 A C program to calculate a writing for 100 times


A C program to cheak a person is eligible for vote or
08
not.
09 A C program to print the day name using switch case

10 A C program to cheak a letter is uppercase or not.


Problem NO:01
Problem Name:
A C program to print “This is my first C program”.
Source Code :

#include<stdio.h>
int main()
{
Printf(“This is my first C Program”);
return 0;
}
Output :
This is my first C Program.
Problem NO:02

Problem Name:

A C Program to find the sum and average of three numbers.


Source Code :
#include <stdio.h>
int main() {
float num1, num2, num3, sum, average;
printf("Enter three numbers: ");
scanf("%f %f %f", &num1, &num2, &num3);
sum = num1 + num2 + num3;
average = sum / 3;
printf("Sum: %.2f\n", sum);
printf("Average: %.2f\n", average);
return 0;
}
Output :
Example output for input 10, 20, 30
Enter three numbers: 10 20 30
Sum: 60.00
Average: 20.00

Problem NO:03
Problem Name :

A C program to calculate the area and circumference of a circle’


Source Code :
#include <stdio.h>
#define PI 3.14159
int main() {
float radius, area, circumference;
printf("Enter the radius of the circle: ");
scanf("%f", &radius);
area = PI * radius * radius;
circumference = 2 * PI * radius;
printf("Area of the circle: %.2f\n", area);
printf("Circumference of the circle: %.2f\n", circumference);
return 0;
}
Output :
Example output for input radius 5
Enter the radius of the circle: 5
Area of the circle: 78.54
Circumference of the circle: 31.42
Problem NO:04
Problem Name :
A C Program to find the factorial of a given number.
Source Code :
#include<stdio.h>
int main()
{
int num,count,fact=1;
printf("Enter the number to find its factorial\n");
scanf("%d",&num);
if(num<0)
{
printf("\nThe factorial of a negetive number is not valid");
}
else
{
for(count=1;count<=num;count++)
fact=count*fact;
printf("The factorial of %d is %d",num,fact);
}
return 0;
} `
Output :
Enter the number to find its factorial
5
The factorial of 5 is 120
Problem NO:05

Problem Name :
A C program to calculate a year is leap year or not.
Source Code :
#include<stdio.h>
int main()
{
int year;
printf("Enter the year\n");
scanf("%d",&year);
if((year%4==0&&year%100!=0)||(year%400==0))
{
printf("\n%d is a leap year",year);
}
else
{
printf("\n%d is not a leap year",year);
}
return 0;
}
Output :
Enter the year
2024
2024 is a leap year
Enter the year
2025
2025 is not a leap year

Problem NO:06

Problem Name :
A C program to calculate anumber is even or odd.
Source Code :
#include<stdio.h>
int main()
{
int num;
printf("Enter the number\n");
scanf("%d",&num);
if(num%2==0)
{
printf("\nThe number is even",num);
}
else
{
printf("\nThe number is odd",num);
}
return 0;
}
Output :
Enter the number
4
The number is even
Enter the number
5
The number is odd

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy