namma_kalvi_std_11_comp_pract_short
namma_kalvi_std_11_comp_pract_short
net
da=basic*80/100;
hra=basic*20/100;
}
else if(basic<40000)
{
da=basic*90/100;
hra=basic*25/100;
}
et
else
.n
{
da=basic*95/100;
ar
hra=basic*30/100;
1. Write a C++ program to input basic salary of an
}
employee and calculate its Gross
riy
salary according to following: gross=basic+hra+da;
Basic Salary <25000 : HRA = 20%, DA = 80% cout<<"\nBasic Pay= "<<basic;
Basic Salary >= 25000 : HRA = 25%, DA = 90% cout<<"\nDearness Allowance= "<<da;
si
Basic Salary >= 40000 : HRA = 30%, DA = 95% cout<<"\nHouse Rent Allowance= "<<hra;
cout<<"\nGross Salary= "<<gross;
.a }
return 0;
w
#include<iostream>
w
int main()
{
float basic,gross,da,hra;
cout<<"Enter Basic Salary:";
cin>>basic;
if(basic<25000) 22.22
{
www.tnschoolvideos.blogspot.in www.tnmanavan.blogspot.com
www.asiriyar.net
et
cout<<"\nThird division";
.n
break;
default:
ar
cout<<"\nFailed";
#include<iostream> }return 0;
riy
using namespace std; }
int main()
{
si
float p;
int x;
cout<<"Enter your percentage:";
.a
w
cin>>p;
w
x=p/10;
switch(x)
w
{
case 10:
case 9:
case 8:
cout<<"\nDistinction";
break;
www.tnschoolvideos.blogspot.in www.tnmanavan.blogspot.com
www.asiriyar.net
et
{ 3. Exit
int n,num,digit,rev=0; Depending on the choice accept the value and display the result
.n
cout<<"Enter a Number:"; .The program should continue till the user select the third
option
cin>>num;
ar
n=num;
while(num)
riy
{
#include <iostream>
digit=num%10;
#include <cmath>
si
rev=(rev*10)+digit;
using namespace std;
num=num/10;
int main()
}
cout<<"Reverse Number:"<<rev<<endl;
.a {
w
int dec,d,i,temp,ch;
if(n==rev)
long int bin;
cout<<"PALINDROME";
w
do
else
{
w
cout<<"NOT PALINDROME";
dec=bin=d=i=0;
return 0;
cout<<"MENU";
}
cout<<"\n 1. Decimal to Binary number";
cout<<"\n 2.Binary to Decimal number";
cout<<"\n 3.Exit\n";
cout <<"Enter your choice(1/2/3)";
www.tnschoolvideos.blogspot.in www.tnmanavan.blogspot.com
www.asiriyar.net
et
{
.n
d = dec%2;
bin += d * pow(10,i);
ar
dec /= 2; i++;
}
riy
cout << “\n Binary Num = “ << bin << endl ;
break;
case 2: cout << "Enter a binary number: ";
si
cin >> bin;
temp=bin;
while (bin!=0)
{
.a
w
d = bin%10;
w
dec += d*pow(2,i);
bin /= 10; i++;
w
}
cout << "\n Decimal num = "<<dec <<endl;
break;
case 3:
break;
default :
www.tnschoolvideos.blogspot.in www.tnmanavan.blogspot.com
www.asiriyar.net
5. CS-5 Write a C++ program using a user defined function int a = -1 , b = 1 ,c=0 ;
to generate the Fibonacci series till n terms and print if for ( int i = 1 ; i <= n ; i++)
each term is prime or Composite. {
cout<<endl;
c=a+b;
cout<<c;
#include <iostream>
Primechk(c);
#include <stdlib.h>
a = b; b = c ;
et
using namespace std;
}
void Primechk (int a )
.n
}
{
int main ()
int j;
ar
{
if ( a == 0 || a == 1 )
int n ;
{
riy
cout << " ENTER THE NUMBER OF TERMS " ;
cout<< " NEITHER PRIME NOR COMPOSITE ";
cin >> n ;
}
cout<< "\n FIBONACCI SERIES\n " ;
else
si
fibo (n) ;
{
return 0;
for (j = 2 ; j<a; j++)
{ if (a%j==0)
.a }
w
{ cout<< "\tCOMPOSITE" ;
break ;
w
}
w
}
if ( a==j )
cout<< "\tPRIME" ;
}
}
void fibo ( int n )
{
www.tnschoolvideos.blogspot.in www.tnmanavan.blogspot.com