0% found this document useful (0 votes)
10 views22 pages

Computer Science (record)

The document contains a series of programming experiments, each detailing a specific task such as calculating simple interest, converting temperature, checking leap years, and more. Each experiment includes code snippets in C++ along with sample outputs demonstrating the functionality of the programs. The document is organized by experiment number, with corresponding dates and remarks for each entry.

Uploaded by

nsnrr9
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)
10 views22 pages

Computer Science (record)

The document contains a series of programming experiments, each detailing a specific task such as calculating simple interest, converting temperature, checking leap years, and more. Each experiment includes code snippets in C++ along with sample outputs demonstrating the functionality of the programs. The document is organized by experiment number, with corresponding dates and remarks for each entry.

Uploaded by

nsnrr9
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/ 22

INDEX

Date of Date of Rernarks


St. No. Namg of the Experimont Page No. Submission
Experiment

JNpUT RTNCIAL ReTE NO- 0F


SARS AND JNTEReST RM6 TO 4lo2/2022
CALCuLA1E SzMpLE JNTEREST

2pRobRAM TO CONVERT
FA HREN HETI UALUE To CELSIUS 2 4lo/2o2
03.PROh RAm TO CHEck IF A Y6AR

04 PRO6kAm TO CHEck F A Num


THAT HAS BEN 4 1s/o2022
JNPUT 1S posTTIVE DA NGh1V

PRDGRAm T JNPUr A Um BER


AND DIspLay T+S FACTORIAL 56/o2aor
06 PROGRm To JNPUT 10 NumBERS
AND CALLULATA THETR Sum
AND AyERAe

DHAT H9s BEEN OVEN AS


|apur 2S AN ARmSTROW
Num BER NOT
INDEX
Date of Date of
Sr. No. Name of the Experiment Page No.
Experiment Stbmission Remarks

AND D2splAY TS_ REVERSE 8alzlho22


STRINh
09pRoRAM TO INpUT A
CHARACTER AND CHAck î TT
iS AN ALpHABET NUMB£R. OR
A SpeCIAL CNARACTER

N
Nym B£RS N AN ARRAY AND
FLND THE AyRA6£ AND
AloNG WITH
THSN' NUMBARS
OUTPUT
Enter the principal amount: 5000
Enter the no of years :3
Enter the rate of Interest :2
Simple Interest is :300
Experiment Name / No.: . Camlin Page No.
Dato /4 I02 2022

APRO RAM UAUAS Of PRTNapAL


RATE AND ANDCALCULAT£ THE SMpL£
JNISREST

#include<lostream.h>
#include<conio.h>
void main()

Intp,n,r,si;
10
clrscr();
cout<<"Enter the principal amount:";
cin>>p;
cout<<"Enter the no of years:";
cin>>n;
cout<<"Enter the rate of interest:";
cin>>r;
15
si=p"n*r/100;
cout<<"Simple interest is:"<<si
getch();

20

Teacher's Signature:
OUTPUT
Enter the Fahrenheit value :98
Celsius value :36.666668
Experiment Name / No.: Camlin Page No 02
Dato ]4 I 02 12022

A pRonRAM TO CoryvET TEMPERATURE AND


To

#include<lostream.h>
#include<conio.h>
void main()
10
Int f;
float c;
clrscr();
cout<<"Enter the fahrenheit value:";
cin>>f;
c=(f-32)*5/9;
15
cout<<"celsius value is:"<<c;
getch();

20

Teacher's Signature:
OUTPUT

Enter the year :2020


2020 isa leap year
Experinment Name / No.: 03 Camlin Pago No. 03
Date /5 I 022022

A PRoORAM JNpUr A CHECk


WHE THER YEAR OR N0T.

#include<lostream.h>
#include<conio.h>
void main()
{
Int year;
10
clrscr();
cout<<"\nEnter the year:";
cin>.year;
If(year%4=-0)
{cout<<"\n" <<year<<"is a leap year:";
If(year%100==0)
cout<,"\n is also a special leap year:";
15

Else
cout<<"\n "<<year << "isnot a leap year:";
getch();

20

Teacher's Signature:
OUTPUT
Enter any no :45
The given no is positive
Experiment Name / No.: 04 Camlin Fagc No. O4
Dato /5I o22022

wRITE A PRonRAM TO ACCEPT NIENR CHEck


OF NÊSAnTVE AND DTspLAY
THE cORRESPONDîNh

#include<lostream.h>
#include<conio.h>
void main()
10
Int n;
clrscr();
cout<<"Enterany no:";
cin>>n;
if(n>0)
cout<<"The given no is positive:";
else
1

cout<<"The given no isnegative:";


getch();

25

Teacher's Signature
OUTPUT
Enter the no :10
Factorial value of 10 is 24320
Experiment Name / No.: O5 Camlin Page No. 0
Date /6 2022

WRITE A PRoh RAm To JupuT A NUmBER N'AND


DSpLAY THE FAcTORIAL OF ALL THE NUmBERS

FRom N USIN A

#include<lostream.h>
#include<conio.h>
void main()
1

Intl,n,f=1;
clrscr();
cout<<"Enterthe no:";
cin>>n;
for(i=1;i<=n;i++)
f=f*1;
15
cout<<"Factorial value of"<<n <<"is" <<f;
getch();
}

Teacher's Signaturt
OUTPUT
Enter 10numbers as input
20
40
60
80
100
120
140
160
180
200
Sum of 10 numbers: 1100
Averageof 10numbers: 110
Experiment Name / No.:.
Camlin Pago No. o6
Date |6 o22022
WRITE A PROGRAm To JNpur NUmBLR AND
THeIR Sum AVERAGE.

#include<iostream.h>
#include<conio.h>
void main()

Inti,n,sum=0;
10

Float aVg;
clrscr();
cout<<"Enterthe 10 numbersas input" <<endi;
for (i=1;i<=10;i++)

cin>>n;
Sum=sum+n;
15

Avg=sum/10.0;
cout<<"sum of 10 numbers:" <<sum <<endi;
cout<<" Average of 10 numbers: "<<avg;
getch();

20

24

Teacher's Signature:
OUTPUT
Enter any positive no: 370
The no is an Armstrong no.
Experiment Name / No.: Camlin Pago No. O7
Date ) 02 2022

WRITE A PROnRAM TO Jnpur A NumBER AND


AN NUmBR OR N0T.

#include<lostream.h>
#include<conio.h>
void main()
{
10 clrscr()
intn,l,num=0,r;
cout<<"Enter any positive no:";
cin>>n;
i=n;
while(i!-0)
15 n=i%10;
num=num+r*r*r;
I=i/10;

If(num=n)
cout<<" The no is Armstrong no:";
else
20
count<<" The no is not an Armstrong no:":
getch();

Teacher's Signature:
OUTPUT
Enter any string: SANJAY
Reversed string is: YAJNAS
Experiment Name / No.: Camlin Page No. O8
Date /7 I02 2o22

WRTTE To JANpUT A
A STRaN AND

DasplAy STRING TN REVERSE.

#include<lostream.h>
#include<conio.h>
void main()
10
{
char s[100],temp;
inti=0, j=0;
clrscr();
cout<<" Enter any string:':
cin>>s;
15
ifstrlen(s)-1;
while(i<j)

temp=s[i:
s[i]=s[jl;
s[i]=temp;
i++;
20

count<<" Reversed string is:"; <<s;


getch();

Teacher's Signature:
OUTPUT
Enter anycharacter: 8
The given character is a digit
Experiment Name /No.: Camlin Page No. 9
Date 1& | 021 2022

wRine A PRohRAm To JNpuî A CHARACTEB AND


wHETH£R
CHÊk ALpHA BES, A
SoME OîHER

#include<lostream.h>
#include<conio.h>
16
void main()
char ch;
clrscr;
cout<<" Enter any character:";
cin>.ch;
if(ch>='a' &&ch<='z') ||(ch>= 'A' &&ch<= 'z')
15
cout<<" The given character is an alphabet:";
else if(ch>= "0' &&ch<='9)
cout<<" The given character is a digit:";
else
cout<<" The given character is aspecial character:";
getch();

20

TeachersSigne
OUTPUT
Give the no of elements :3

Enter no 1:
30

Enter o2:
50

Enter no 3:
40

Youentered
30
50
40
Average is :40
Experiment Name /No.: Camlin Pago No. |O
Dato /& l02- 12022

WRITEA PRoRAm NUmBERS


FRon THE USER AND pACES THEry TN ARRAY
FlOPr PEN FIND THE AVERA(OE AND
PRSN 17 ALonG NUMBSRS

#include<lostream.h>
#include<conio.h>
void main()

Int n, *p,sum=0,1,num[100];
10
Float ag;
clrscr
cout<<" Give the no of elements:";
cin>>n;
for(i=0;i<n;i++)
cout<<endl<<" Enter no"<<i+1 <<":" <<endl;
15
cin>.num[i];

P=num
Cout<<endl<<"Youentered";
For(i-0;i<n;i++)
{
Sum=sum+*(p+i);
20
Avg-(float)sum/n;
}
Cout<<endk<" Average is:"; <<avg;
getch();

25

Teacher's Signature:

You might also like