Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
SOLVED LAB WORK OF COMPUTER APPLICATIONS(COMMERCE)
2023-24
1. Input three numbers and find the largest.
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Find the largest number among three\n\n\n";
cout<<"Enter three numbers :";
cin>>a>>b>>c;
if((a>b) && (a>c))
cout<<"The largest number is :"<<a;
else if(b>c)
cout<<"The largest number is :"<<b;
else
cout<<"The largest number is :"<<c;
return 0;
}
OUTPUT
Find the largest number among three
Enter three numbers :23 76 54
The largest number is :76
2. Input the principal amount, type of account (C for current a/c or S for SB a/c) and number of years, and
display the amount of interest. Rate of interest for current a/c is 8.5% and that of SB a/c is 6.5%.
#include<iostream>
using namespace std;
int main()
{
int am,yr;
char ty;
float cint,sint;
cout<<"Enter the principle amount :\n";
cin>>am;
cout<<"Enter the type of account(c for current and s for savings)\n";
cin>>ty;
cout<<"Enter the number of years (period of deposit) :";
cin>>yr;
cint=(am*8.5/100)*yr;
sint=(am*6.5/100)*yr;
if((ty=='c') || (ty=='C'))
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:1
, Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
cout<<"The rate of interest (Current Account) :"<<cint;
else if((ty=='s') || (ty=='S'))
cout<<"the rate of interest (Savings) :"<<sint;
return 0;
}
OUTPUT
Enter the principle amount :
1000
Enter the type of account(c for current and s for savings)
c
Enter the number of years (period of deposit) :2
The rate of interest (Current Account) :170
Enter the principle amount :
1000
Enter the type of account(c for current and s for savings)
s
Enter the number of years (period of deposit) :2
the rate of interest (Savings) :130
3. Input a digit and display the same in word. (Zero for 0, One for 1, …., Nine for 9)
#include <iostream>
using namespace std;
int main()
{
long int n,sum=0,r;
cout<<"Enter the Number= ";
cin>>n;
while(n>0)
{
r=n%10;
sum=sum*10+r;
n=n/10;
}
n=sum;
while(n>0)
{
r=n%10;
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:2
, Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
switch(r)
{
case 1:
cout<<"one ";
break;
case 2:
cout<<"two ";
break;
case 3:
cout<<"three ";
break;
case 4:
cout<<"four ";
break;
case 5:
cout<<"five ";
break;
case 6:
cout<<"six ";
break;
case 7:
cout<<"seven ";
break;
case 8:
cout<<"eight ";
break;
case 9:
cout<<"nine ";
break;
case 0:
cout<<"zero ";
break;
default:
cout<<"not valid";
break;
}
n=n/10;
}
}
OUTPUT
Enter the Number= 485
four eight five
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:3
SOLVED LAB WORK OF COMPUTER APPLICATIONS(COMMERCE)
2023-24
1. Input three numbers and find the largest.
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Find the largest number among three\n\n\n";
cout<<"Enter three numbers :";
cin>>a>>b>>c;
if((a>b) && (a>c))
cout<<"The largest number is :"<<a;
else if(b>c)
cout<<"The largest number is :"<<b;
else
cout<<"The largest number is :"<<c;
return 0;
}
OUTPUT
Find the largest number among three
Enter three numbers :23 76 54
The largest number is :76
2. Input the principal amount, type of account (C for current a/c or S for SB a/c) and number of years, and
display the amount of interest. Rate of interest for current a/c is 8.5% and that of SB a/c is 6.5%.
#include<iostream>
using namespace std;
int main()
{
int am,yr;
char ty;
float cint,sint;
cout<<"Enter the principle amount :\n";
cin>>am;
cout<<"Enter the type of account(c for current and s for savings)\n";
cin>>ty;
cout<<"Enter the number of years (period of deposit) :";
cin>>yr;
cint=(am*8.5/100)*yr;
sint=(am*6.5/100)*yr;
if((ty=='c') || (ty=='C'))
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:1
, Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
cout<<"The rate of interest (Current Account) :"<<cint;
else if((ty=='s') || (ty=='S'))
cout<<"the rate of interest (Savings) :"<<sint;
return 0;
}
OUTPUT
Enter the principle amount :
1000
Enter the type of account(c for current and s for savings)
c
Enter the number of years (period of deposit) :2
The rate of interest (Current Account) :170
Enter the principle amount :
1000
Enter the type of account(c for current and s for savings)
s
Enter the number of years (period of deposit) :2
the rate of interest (Savings) :130
3. Input a digit and display the same in word. (Zero for 0, One for 1, …., Nine for 9)
#include <iostream>
using namespace std;
int main()
{
long int n,sum=0,r;
cout<<"Enter the Number= ";
cin>>n;
while(n>0)
{
r=n%10;
sum=sum*10+r;
n=n/10;
}
n=sum;
while(n>0)
{
r=n%10;
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:2
, Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
switch(r)
{
case 1:
cout<<"one ";
break;
case 2:
cout<<"two ";
break;
case 3:
cout<<"three ";
break;
case 4:
cout<<"four ";
break;
case 5:
cout<<"five ";
break;
case 6:
cout<<"six ";
break;
case 7:
cout<<"seven ";
break;
case 8:
cout<<"eight ";
break;
case 9:
cout<<"nine ";
break;
case 0:
cout<<"zero ";
break;
default:
cout<<"not valid";
break;
}
n=n/10;
}
}
OUTPUT
Enter the Number= 485
four eight five
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:3