# C pgms

1. Factorial value of a number using recursive function
#include
#include
long fact(int n)
{
if(n==0)
return 1;
return (n*fact(n-1));
}
void main()
{
int num;
cout>num;
cout
#include
#include
void main()
{
clrscr();
char str[100];
int i,totChar;
totChar=0;
cout
#include
int swap(int &,int &);
void main()
{
int a,b;
clrscr();
cout>a>>b;
coutOUTPUT
Swapping Two numbers
10

5

Before swapping
A = 10
B=5
After Swapping
A=5
B = 10

4. Salary slip using class and Object
#include
#include
class Employee
{
clrscr();
int eid;
char ename[100];
float basic_salary, hra, da, i_tax, net_salary;
public:
void accept_details()
{
cout>eid;
cout>ename;
cout>basic_salary;
hra = 800;
da = 0.25 * basic_salary;
i_tax = 0.15 * basic_salary;
net_salary = basic_salary + da + hra – i_tax;
}
void display_details()
{
cout
#include
class fibonacci
{
private:
unsigned long int f0,f1,fib;
public:
fibonacci()
{
f0=0;
f1=1;
fib=f0+f1;
}
fibonacci (fibonacci &ptr)
{
f0=ptr.f0;
f1=ptr.f1;
fib=ptr.fib;
}
void increment()
{
f0=f1;
f1=fib;
fib=f0+f1;
}
void display()
{
cout
#include
#include
#include
class area
{
float ar;
public:
area(float r)
{
ar=3.14*r*r;
}
area(float l, float b)
{
ar=l*b;
}
area(float a, float b, float c)
{
float s;
s=(a+b+c)/2;
ar=s*(s-a)*(s-b)*(s-c);
ar=pow(ar,0.5);
}
void display()
{
cout>ch;
switch(ch)
{
case 1 :
{
cout>x;
area a1(x);
a1.display();
break;
}
case 2 :
{
cout>x>>y;
area a2(x,y);
a2.display();
break;
}
case 3 :
{
cout>x>>y>>z;
area a3(x,y,z);
a3.display();
break;
}
case 4 :
exit(0);
default :
cout
#include
#include
{
public:
char s1[25], s2[25];
{
strcpy(this->s1, str1);
strcpy(this->s2, str2);
}
void operator+()
{
cout >str1;
cout>str2;
+a1;
getch();
}
OUTPUT
Enter the first string : Good
Enter the second string : Morning
Concatenated String : GoodMoring
8. Electricity Bill Calculation using Derived class
#include
#include
class electricity
{
protected:
float unit;
float cost;
public:
void bill()
{
cout>unit;
if(unit300)
{
cost=0.60*unit;
cout250.00)
{
diff=cost-250;
surcharge=diff*0.15;
cout
#include
int a,b;
{
public:
void getdata();
friend void display();
};
{
cout>a>>b;
}
void display()
{
cout
#include
#include
void main()
{
ofstream fout(“student”);
char str[20];
int i,n;
clrscr();
cout>n;
for(i=0;i>str;
cout

Calculate the price
Pages (550 words)
\$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend