Pps Progs Manual
Pps Progs Manual
Write a simple program that prints the results of all the operators available in C (including
pre/post increment, bitwise and /or/not, etc.).Read required operand values from standard
input.
c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c=a/b;
printf("a/b = %d \n",c);
c=a%b;
printf("Remainder when a divided by b = %d \n",c);
return 0;
}
Output
a+b = 13
a-b = 5
a*b = 36
a/b = 2
Remainder when a divided by b=1
1 |Page
float c = 10.5, d = 100.5;
return 0;
}
Output
++a = 11
--b = 99
++c = 11.500000
++d = 99.50000
c = a;
printf("c = %d \n", c);
c += a; // c = c+a
printf("c = %d \n", c);
c -= a; // c = c-a
printf("c = %d \n", c);
c *= a; // c = c*a
printf("c = %d \n", c);
c /= a; // c = c/a
printf("c = %d \n", c);
2 |Page
c %= a; // c = c%a
printf("c = %d \n", c);
return 0;
}
Output
c=5
c = 10
c=5
c = 25
c=5
c=0
3 |Page
return 0;
}
Output
5 == 5 = 1
5 == 10 = 0
5>5=0
5 > 10 = 0
5<5=0
5 < 10 = 1
5 != 5 = 0
5 != 10 = 1
5 >= 5 = 1
5 >= 10 = 0
5 <= 5 = 1
5 <= 10 = 1
#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10, result;
4 |Page
result = !(a == b);
printf("!(a == b) equals to %d \n", result);
return 0;
}
Output
sizeof Operator
#include <stdio.h>
int main()
{
int a, e[10];
float b;
double c;
char d;
printf("Size of int=%lu bytes\n",sizeof(a));
printf("Size of float=%lu bytes\n",sizeof(b));
printf("Size of double=%lu bytes\n",sizeof(c));
printf("Size of char=%lu byte\n",sizeof(d));
printf("Size of integer type array having 10 elements = %lu bytes\n", sizeof(e));
return 0;
}
Output
5 |Page
C conditional Operator
#include <stdio.h>
int main(){
char February;
int days;
printf("If this year is leap year, enter 1. If not enter any integer: ");
scanf("%c",&February);
Output
2. Write a simple program that converts one given data type to another using auto conversion
and casting. Take the values from standard input.
6 |Page
}
Output:
x = 107, z = 108.000000
int main()
{
double x = 1.2;
return 0;
}
Output:
sum = 2
3. Write a program for find the max and min from the three numbers.
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter 3 numbers");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
printf("Mximum number is a = %d",a);
else if(b>a && b>c)
printf("Mximum number is b = %d",b);
else
printf("Mximum number is c = %d",c);
if(a<b && a<c)
printf("Minimum number is a = %d",a);
else if(b<a && b<c)
printf("Minimum number is b = %d",b);
7 |Page
else
printf("Minimum number is c = %d",c);
}
#include<stdio.h>
#include<math.h>
int main()
int p,t;
float r,si,amount,ci;
scanf("%d%d%f",&p,&t,&r);
si=p*t*r/100;
amount=p*pow((1 +r/100),t);
ci=amount-p;
Input
Enter principle (amount): 1200
Enter time: 2
Enter rate: 5.4
Output
8 |Page
5. Write program that declares class awarded for a given percentage of marks, where
mark<40%=failed, 40% to <60%= second class, 60% to <70%=First
class, >=70%=Distinction, read percentage from standard input.
#include<stdio.h>
void main()
{
int m1,m2,m3,total;
float per;
clrscr();
printf("Enter 3 Nos.");
scanf("%D%D%D",&m1,&m2,&m3);
total=m1+m2+m3;
per=total*100/300;
if(per>=60&&per<=100)
printf("You are 1st :");
else if(per>=50&&per<=60)
printf("You are 2nd");
else if(per>=40&&per<=50)
printf("You are 3rd");
else
printf("You are Fail");
getch();
}
6. Write program that prints multiplication table for a given number and the number of rows
in the table. for example, for a number 5 and rows=3,the output should be:
5x1=5
5x2=10
5x3=15
#include <stdio.h>
int main()
int n, i;
scanf("%d",&n);
9 |Page
for(i=1; i<=10; ++i)
return 0;
Output
Enter an integer: 5
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
7. Write a program that shows the binary equivalent of a given positive number
Between 0 to 255.
#include <stdio.h>
int main()
{
long long decimal, tempDecimal, binary;
int rem, place = 1;
binary = 0;
10 | P a g e
/* Decimal to binary conversion */
while(tempDecimal > 0)
{
rem = tempDecimal % 2;
tempDecimal /= 2;
place *= 10;
}
return 0;
} of decimal = 0111000
8. A building has 10 floor heights of 3 meters each. A ball is dropped from the top of the
building. Find the time taken by the ball to reach each floor.(use formula s=ut+(1/2)at^2
where u and a are the initial velocity in m/sec(=0) and acceleration in m/sec^2(=9.8 m/s^2)).
#include<stdio.h>
#include<conio.h>
void main()
{
float u,t,a,S;
clrscr();
printf(“enter values u,t,a”);
scanf(“%f %f %f”, &u,&t,&a);
S=(u*t)+(0.5*a*t*t);
printf(“\n S = %f”, S);
11 | P a g e
}
9. Write a program which takes two integer operands and one operator from the user, performs
the operation and then prints the result.(consider the operators +,-,*,/,% and use switch
statement).
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b;
printf("\n Enter two numbers:");
scanf("%d%d",&a,&b);
int choice;
printf("\n Operation to perform :");
printf("\n1.Addition \n2.Subtraction \n3.multiplication
\n4.division \n5.modulus ");
scanf("\n%d",&choice);
switch(choice)
{
case 1: printf("\n Addition = %d",a+b);
break;
case 2: printf("\n Subtraction = %d",a-b);
break;
case 3: printf("\n Multiplication = %d",a*b);
break;
case 4: printf("\n Division = %d",a/b);
break;
case 5: printf("\n Modulus = %d",a%b);
break;
default:printf("\n Invalid choice");
}
getch();
}
OUTPUT:
1.Addition
12 | P a g e
2.Subtraction
3.Multiplication
4.Division
Enter the values of a & b: 20 15
Enter your Choice : 1
Sum of 20 and 15 is : 35
#include <stdio.h>
int main()
int n, i, flag = 0;
scanf("%d",&n);
if(n%i==0)
flag=1;
break;
if (flag==0)
else
13 | P a g e
return 0;
Output
29 is a prime number.
11. Write a C program to find the sum of individual digits of positive integer and test given
number is palindrome.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main ()
clrscr();
scanf("%d", &number);
while (number != 0)
getch();
14 | P a g e
Input & Output:
1234
12. A Fibonacci sequence is defined as follows: the first and second terms in the sequence are
0 and 1.subsequent terms are found by adding the preceding two terms in the sequence.
Write a C program to generate the first n terms of the sequence.
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
scanf("%d", &lengthOfSeries);
printf("Fibonacci series\n");
sum = a + b;
printf(" %d",sum);
15 | P a g e
a = b;
b = sum;
getch();
15
Fibonacci series
13. Write a C program to generate all the prime numbers between 1 and n, where n is a
value supplied by the user.
#include<stdio.h>
#include<conio.h>
void main()
int n, i, j, count;
clrscr();
printf("Prime no.series\n");
16 | P a g e
printf("Enter any number\n");
scanf("%d", &n);
count = 0;
if(i % j == 0)
count++;
if(count == 2)
printf("%d\t", i);
getch();
17 | P a g e
Enter any number
10
2 3 5 7
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
clrscr();
if(a == 0 || b == 0 || c == 0)
else
d = (b * b) - (4.0 * a * c);
18 | P a g e
root2 = -b - sqrt(d) / (2.0 * a);
root1 = -b / (2.0 * a) ;
else if (d == 0.00)
root2 = root1;
getch();
1 2 3
#include <stdio.h>
19 | P a g e
void main()
float x,sum,t,d;
int i,n;
scanf("%f",&x);
scanf("%d",&n);
sum =1; t = 1;
for (i=1;i<n;i++)
d = (2*i)*(2*i-1);
t = -t*x*x/d;
sum =sum+ t;
20 | P a g e
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
int n, x, i, sum = 0;
clrscr();
scanf("%d", &n);
scanf("%d", &x);
printf("illegal value");
else
21 | P a g e
printf("sum=%d", sum);
getch();
sum=31
#include <stdio.h>
int main()
{
int arr[MAX_SIZE];
int i, max, min, size;
22 | P a g e
/* Assume first element as maximum and minimum */
max = arr[0];
min = arr[0];
/*
* Find maximum and minimum in all array elements.
*/
for(i=1; i<size; i++)
{
/* If current element is greater than max */
if(arr[i] > max)
{
max = arr[i];
}
return 0;
}
#include <stdio.h>
int main()
int n, i;
23 | P a g e
printf("Enter the numbers of elements: ");
scanf("%d", &n);
scanf("%d", &n);
scanf("%f", &num[i]);
sum += num[i];
average = sum / n;
return 0;
Output
24 | P a g e
4. Enter number: 20.34
5. Enter number: 33
Average = 27.69
18. Write a functions to compute mean, variance, Standard Deviation, sorting of n elements
in a single dimension array.
#include <stdio.h>
#include <math.h>
#define MAXSIZE 10
void main()
{
float x[MAXSIZE];
int i, n;
float average, variance, std_deviation, sum = 0, sum1 = 0;
25 | P a g e
variance = sum1 / (float)n;
std_deviation = sqrt(variance);
printf("Average of all elements = %.2f\n", average);
printf("variance of all elements = %.2f\n", variance);
printf("Standard deviation = %.2f\n", std_deviation);
}
output
Enter the value of N
5
Enter 5 real numbers
34
88
32
12
10
Average of all elements = 35.20
variance of all elements = 794.56
Standard deviation = 28.19
#include <conio.h>
void main()
clrscr();
26 | P a g e
printf("Enter the elements of 3*3 matrix a \n");
scanf("%d", &a[i][j]);
scanf("%d", &b[i][j]);
27 | P a g e
c[i][j] = a[i][j] + b[i][j];
printf("%d\t", c[i][j]);
printf("\n");
getch();
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
28 | P a g e
2 4 6
8 10 12
14 16 18
#include<conio.h>
void main()
clrscr();
scanf("%d", &a[i][j]);
29 | P a g e
for(j = 0; j < 3; j++)
scanf("%d", &b[i][j]);
c[i][j] = 0
30 | P a g e
{
printf("%d\t", c[i][j]);
printf("\n");
getch();
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
30 36 42
55 81 96
iii Transpose of a matrix with memory dynamically allocated for the new matrix as row and column
counts may not be same.
#include <stdio.h>
int main()
31 | P a g e
{
scanf("%d", &a[i][j]);
if (j == c-1)
printf("\n\n");
transpose[j][i] = a[i][j];
32 | P a g e
// Displaying the transpose of matrix a
printf("\nTranspose of Matrix:\n");
printf("%d ",transpose[i][j]);
if(j==r-1)
printf("\n\n");
return 0;
Output
33 | P a g e
Enter element a23: 4
Entered Matrix:
2 3 4
5 6 4
Transpose of Matrix:
2 5
3 6
4 4
20. Write C programs that use both recursive and non-recursive functions
i To find the factorial of a given integer.
ii To find GCD (greatest common divisor) of two given integers.
iii To find x^n.
#include <stdio.h>
34 | P a g e
#include <conio.h>
void main()
int n, a, b;
clrscr();
scanf("%d", &n);
a = recfactorial(n);
b = nonrecfactorial(n);
getch();
int recfactorial(int x)
int f;
if(x == 0)
return(1);
else
f = x * recfactorial(x - 1);
return(f);
int nonrecfactorial(int x)
int i, f = 1;
35 | P a g e
{
f = f * i;
return(f);
#include <stdio.h>
#include <conio.h>
void main()
int a, b, c, d;
clrscr();
c = recgcd(a, b);
d = nonrecgcd(a, b);
getch();
if(y == 0)
36 | P a g e
{
return(x);
else
return(recgcd(y, x % y));
int z;
while(x % y != 0)
z = x % y;
x = y;
y = z;
return(y);
3 6
#include <stdio.h>
37 | P a g e
int power(int n1, int n2);
int main()
scanf("%d",&base);
scanf("%d",&powerRaised);
return 0;
if (powerRaised != 0)
else
return 1;
Output
38 | P a g e
3^4 = 81
21. Write a program for reading elements using pointer into array and display the values
using array.
#include <stdio.h>
int main()
int data[5], i;
return 0;
Output
Enter elements: 1
39 | P a g e
4
You entered:
22. Write a program for display values reverse order from array using pointer.
#include
#include
#include
int main()
{
int *ptr,i,n;
clrscr();
printf(“Enter the no of elements:”);
scanf(“%d”,&n);
ptr=(int *)malloc(sizeof(int)*n);
if(ptr==NULL)
{
printf(“Not enough memory”);
exit(1);
}
for(i=0; i<n; i++)
{
printf(“Enter %d element : “,i+1);
scanf(“%d”,&ptr[i]);
}
printf(“Array in original order\n”);
for(i=0; i<n; i++)
{
printf(“%d\n”,ptr[i]);
}
40 | P a g e
printf(“Array in reverse order\n”);
for(i=n-1; i>=0; i–)
{
printf(“%d\n”,ptr[i]);
}
getch();
return 0;
}
Output:
Enter the no of elements:5
Enter 1 element : 12
Enter 2 element : 56
Enter 3 element : 89
Enter 4 element : 45
Enter 5 element : 23
Array in original order
12
56
89
45
23
Array in reverse order
23
45
89
56
12
23. Write a program through pointer variable to sum of n elements from array.
#include<stdio.h>
int main(){
int *pointr;
41 | P a g e
//How many numbers to be added
scanf("%d", &n);
scanf("%d", &elements[i]);
pointr = elements;
++pointr;
Sample Output:
24. Write a C program to display the contents of a file to standard output device.
#include<stdio.h>
#include<conio.h>
FILE *fp1,*fp2;
char c;
void main()
42 | P a g e
clrscr();
putc(c, fp1);
fclose(fp1);
fp1 = fopen("abc.txt","r");
fp2=fopen("xyz.txt","w");
while(!feof(fp1))
c = getc(fp1);
putc(c,fp2);
fclose(fp1);
fclose(fp2);
while(!feof(fp2))
c = getc(fp2);
printf("%c", c);
getch();
^Z
43 | P a g e
engineering students are very good.
25. Write a C program which copies one file to another, replacing all lowercase characters
with their upper case equivalents.
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp1,*fp2;
char *fn1,*fn2,ch;
clrscr();
printf("\n enter the source file");
gets(fn1);
printf("\n enter the destination file");
gets(fn2);
fp1=fopen(fn1,"r");
fp2=fopen(fn2,"w");
if(fp1==NULL||fp2==NULL)
{
printf("\n unable to open file");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
if(ch>='a'&& ch<='z')
ch=ch-32;
fputc(ch,fp2);
}
printf("\n file successfully copied");
fcloseall();
getch();
}
output
Enter a sentence
wELCOME tO sANFOUNDRY
The given sentence is : wELCOME tO sANFOUNDRY
Case changed sentence is: Welcome To Sanfoundry
26. Write a C program to count the number of times a character occurs in a text file. The
44 | P a g e
file name and the character are supplied as command line arguments.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i=0,j=0,count=0;
char str1[100],str2[20],str3[20];
clrscr();
printf(“Enter the text: “);
gets(str1);
if(str1[i]==”)
break;
else
i++;
}
#include<stdio.h>
/* Our structure */
45 | P a g e
struct record
int a,b,c;
};
int main()
int count;
FILE *ptr;
ptr=fopen("test.bin","rb");
if (!ptr)
} fclose(ptr);
return 0;
28. Write a C program to merge two files into a third file (i.e., the contents of the first t file followed
by those of the second are put in the third file).
46 | P a g e
#include<stdio.h>
return 0;
int i, ch;
putc(ch, fp2);
File1:
studentboxoffice.in.
File2:
File 3:
29. Write a C program to convert a Roman numeral ranging from I to L to its decimal
equivalent.
47 | P a g e
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
void main()
char rom[30];
clrscr();
scanf("%s", &rom);
l =strlen(rom);
switch (rom[i])
break;
break;
break;
break;
break;
break;
break;
48 | P a g e
default : printf("Invalid choice");
break;
k = a[l - 1];
k = k - a[i - 1];
k = k + a[i - 1];
getch();
XIV
Decimal equivalent is 14
30. Write a C program that converts a number ranging from 1 to 50 to Roman equivalent.
#include<stdio.h>
49 | P a g e
char roman_Number[1000];
int i=0;
int main(){
int j;
long int number;
while(number != 0){
50 | P a g e
if(number < (50 + 4 * 10)){
postdigits('L',number/50);
number = number - (number/50) * 50;
}
else{
predigits('X','C');
number = number - (100-10);
}
}
else if(number >=10){
if(number < (10 + 3 * 10)){
postdigits('X',number/10);
number = number - (number/10) * 10;
}
else{
predigits('X','L');
number = number - (50-10);
}
}
else if(number >=5){
if(number < (5 + 4 * 1)){
postdigits('V',number/5);
number = number - (number/5) * 5;
}
else{
predigits('I','X');
number = number - (10-1);
}
}
else if(number >=1){
if(number < 4){
postdigits('I',number/1);
number = number - (number/1) * 1;
}
else{
predigits('I','V');
number = number - (5-1);
}
}
}
51 | P a g e
return 0;
Sample output:
31. Write a C program that uses functions to perform the following operations:
i To insert a sub-string in to a given main string from a given position.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
52 | P a g e
{
clrscr();
gets(str1);
l1 = strlen(str1);
gets(str2);
l2 = strlen(str2);
scanf("%d", &n);
str1[n + i] = str2[i];
str2[l2 + 1] = '\0';
getch();
sachin
tendulkar
53 | P a g e
Enter the position where the string is to be inserted
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char str[20];
int i, n, l, pos;
clrscr();
gets(str);
scanf("%d", &pos);
scanf("%d", &n);
l = strlen(str);
str[i - n] = str[i];
str[i - n] = '\0';
getch();
54 | P a g e
Input & Output:
sachin
32. Write a C program to determine if the given string is a palindrome or not (Spelled
same in both directions with or without a meaning like madam, civic, noon, abcba,
etc.)
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
char str[20];
int i, l, f = 0;
clrscr();
gets(str);
l = strlen(str);
f = f + 1;
if(f == l)
55 | P a g e
{
else
getch();
malayalam
33. Write a C program that displays the position of a character ch in the string S or -
1 if S doesn’t contain ch.
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
char *found;
clrscr();
gets(s);
gets(t);
56 | P a g e
found = strstr(s, t);
if(found)
else
printf("-1");
getch();
kali
li
34. Write a C program to count the lines, words and characters in a given text.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
char str[100];
int i = 0, l = 0, f = 1;
clrscr();
57 | P a g e
puts("Enter any string\n");
gets(str);
l = l + 1;
f = f + 1;
getch();
35. Write a menu driven C program that allows a user to enter n numbers and then
choose between finding the smallest, largest, sum, or average. The menu and all
the choices are to be functions. Use a switch statement to determine what action
to take. Display an error message if an invalid choice is entered.
#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
58 | P a g e
{
int optn,a,b;
float c;
printf("\n1.Add: ");
printf("\n2.Subtract: ");
printf("\n3.Multiply: ");
printf("\n4.Divide: ");
printf("\n5.Exit: ");
printf("\nWhat u want to do?: ");
scanf("%d",&optn);
switch(optn)
do
{
case 1: printf("\nEnter Numbers to Add: ");
scanf("%d %d",&a,&b);
c=a+b;
printf("Addition's Result Is= %f",c);
break;
case 5: exit(0);
default :printf("\n Invalid option...");
}while(optn!=0);
getch();
}
59 | P a g e
36. Write a C program to construct a pyramid of numbers as follows:
1 * 1 1
12 ** 23 22
123 *** 456 333
4444
#include <stdio.h>
int main()
int i, j, rows;
scanf("%d",&rows);
printf("%d ",j);
printf("\n");
return 0;
Output:
1 2
1 2 3
1 2 3 4
60 | P a g e
1 2 3 4 5
#include <stdio.h>
int main()
int i, j, rows;
scanf("%d",&rows);
printf("* ");
printf("\n");
return 0;
Output:
* *
* * *
* * * *
61 | P a g e
* * * * *
#include <stdio.h>
int main()
scanf("%d",&rows);
++number;
printf("\n");
return 0;
Output:
2 3
4 5 6
62 | P a g e
7 8 9 10
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,n;
clrscr();
printf("Enter pyramid range:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
printf(" ");
for(j=0;j<i;j++)
printf("%d ",i);
printf("\n");
}
getch();
}
Output:
Enter pyramid range:6
1
2 2
3 3 3
37. Write a C program that uses non recursive function to search for Key value in
a given list of integers using linear search method.
#include<stdio.h>
#include<conio.h>
void main()
63 | P a g e
clrscr();
scanf(“%d”, &n);
scanf(“%d”, &a[i]);
scanf(“%d”, &key);
if(a[i] == key)
flag = 1;
break;
if(flag == 1)
else
getch();
64 | P a g e
38. Write a C program that uses non recursive function to search for a Key value in a
given sorted list of integers using binary search method.
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
scanf(“%d”, &a[i]);
scanf(“%d”, &key);
low = 0;
high = n - 1;
if(key == a[mid])
break;
else
low = mid + 1;
else
65 | P a g e
high = mid - 1;
if(key == a[mid])
else
getch();
39. Write a C program that implements the Bubble sort method to sort a given list of
integers in ascending order.
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
scanf("%d", &n);
66 | P a g e
{
scanf("%d", &a[i]);
temp = a[j];
a[j + 1] = temp;
printf("%d\n", a[i]);
getch();
40. Write a C program that sorts the given array of integers using selection sort in
descending order.
#include<stdio.h>
67 | P a g e
#include<conio.h>
void main()
clrscr();
scanf("%d", &n);
scanf("%d", &a[i]);
min = i;
min = j;
temp = a[i];
a[i] = a[min];
a[min] = temp;
printf("%d\n", a[i]);
getch();
68 | P a g e
Enter the size of the array: 7
41. Write a C program that sorts the given array of integers using insertion sort in
ascending order.
#include<stdio.h>
int main() {
int i, j, num, temp, arr[20];
return 0;
}
69 | P a g e
Output:
Enter total elements: 5
Enter 5 elements: 9 4 1 0 2
After sorting: 0 1 2 4 9
#include <stdio.h>
#include <string.h>
void main()
{
70 | P a g e
for (j = i + 1; j < n; j++)
{
if (strcmp(name[i], name[j]) > 0)
{
strcpy(temp, name[i]);
strcpy(name[i], name[j]);
strcpy(name[j], temp);
}
}
}
printf("\n----------------------------------------\n");
printf("Input NamestSorted names\n");
printf("------------------------------------------\n");
printf("------------------------------------------\n");
Output:
----------------------------------------
Input Names Sorted names
------------------------------------------
heap class
stack heap
queue object
71 | P a g e
object program
class project
program queue
project stack
------------------------------------------
72 | P a g e