0% found this document useful (0 votes)
131 views

Adv C Slip Solution

The C program accepts details of items like code, name and price using a structure. It performs two operations - displays items having price more than a given value, and searches for an item by name entered by the user. The user is prompted to enter the number of items, and a for loop is used to input details of each item into the structure array.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views

Adv C Slip Solution

The C program accepts details of items like code, name and price using a structure. It performs two operations - displays items having price more than a given value, and searches for an item by name entered by the user. The user is prompted to enter the number of items, and a for loop is used to input details of each item into the structure array.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Slip 1:-

Write a C program to accept details of n students (roll number, name,


percentage) using structure. Display details of the student having
maximum percentage.
#include <stdio.h>
struct student {
charfirstName[50];
int roll;
float marks;
} s[10];
int main() {
int i;
printf("Enter information of students:\n");
for (i = 0; i < 5; ++i) {
s[i].roll = i + 1;
printf("\nFor roll number%d,\n", s[i].roll);
printf("Enter first name: ");
scanf("%s", s[i].firstName);
printf("Enter marks: ");
scanf("%f", &s[i].marks);
}
printf("Displaying Information:\n\n");
for (i = 0; i < 5; ++i) {
printf("\nRoll number: %d\n", i + 1);
printf("First name: ");
puts(s[i].firstName);
printf("Marks: %.1f", s[i].marks);
printf("\n");
}
return 0;
}
OUTPUT:-
Enter information of students:

For roll number1,


Enter name: Tom
Enter marks: 98

For roll number2,


Enter name: Jerry
Enter marks: 89

Displaying Information:
Roll number: 1
Name: Tom
Marks: 98
Slip 2:-
Write a menu driven program to perform the following operations on
strings using standard library functions:
1. Convert string to uppercase
2. Copy one string to another
3. Compare two strings
4. Concatenate two strings
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#include <ctype.h>
int main()
{
char s1[50],s2[50];
int ch,i;
printf("\nMenu :\n 1.Convert string to uppercase\n");
printf(" 2. Copy one string to another\n");
printf("3. Compare two strings\n 4. Concatenate two strings\n");
printf("5. Exit\n Enter your choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("\n Enter String: ");
scanf("%s",s1);
printf("\n Converted String: ");
for(i=0;i<strlen(s1);i++)
printf("%c",toupper(s1[i]));
break;
case 2: printf("\n Enter String: ");
scanf("%s",s1);
strcpy(s2,s1);
printf("\n Copied String is : %s",s2);
break;
case 3: printf("\n Enter string1 : ");
scanf("%s",s1);
printf("\n Enter String2 : ");
scanf("%s",s2);
if(strcmp(s1,s2)==0)
printf("\n Entered strings are equal...");
else
printf("\n Entered strings are different..");
break;
case 4: printf("\n Enter string1 : ");
scanf("%s",s1);
printf("\n Enter string2 : ");
scanf("%s",s2);
printf("\n Concatenated string : %s",strcat(s1,s2));
break;
case 5: exit(0);
break;
default: printf("\n Enter proper choice");
} //end switch
return 0;
}

Slip 3:-
Write a program to declare a structure person (name, address) which
contains another structure birthdate (day, month, year). Accept the details
of n persons and display them.
#include <stdio.h>
struct student{
char name[30];
introllNo;
structdateOfBirth{
intdd;
int mm;
intyy;
}DOB;
};
int main()
{
struct student std;
printf("Enter name: "); gets(std.name);
printf("Enter roll number: "); scanf("%d",&std.rollNo);
printf("Enter Date of Birth [DD MM YY] format: ");
scanf("%d%d%d",&std.DOB.dd,&std.DOB.mm,&std.DOB.yy);
printf("\nName : %s \nRollNo : %d \nDate of birth : %02d/%02d/%02d\
n",std.name,std.rollNo,std.DOB.dd,std.DOB.mm,std.DOB.yy);

return 0;
}
OUTPUT:-
Enter name: Mike
Enter roll number: 101
Enter Date of Birth [DD MM YY] format: 14 03 92

Name : Mike
RollNo : 101
Date of birth : 14/03/92

Slip:-4
Write a program to copy contents of file a.txt to b.txt by changing the
case of each alphabet.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>

int main()
{
FILE *fp1,*fp2;
char ch;
fp1=fopen("a.txt","r");
fp2=fopen("b.txt","w");
if(!fp1)
printf("\n Error in reading..");
if(!fp2)
printf("\n Error in writing..");
else
{
while((ch=fgetc(fp1))!=EOF)
{
if(isupper(ch))
fputc(tolower(ch),fp2);
else
fputc(toupper(ch),fp2);
}
}
return 0;
}

Slip:-5
Write a program to read the contents of a text file and count the number of
characters, lines and words in the file.
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE * file;
char path[100];
char ch;
int characters, words, lines;
file=fopen("counting.txt","w");
printf("enter the text.press cntrl Z:\n");
while((ch = getchar())!=EOF){
putc(ch,file);
}
fclose(file);
printf("Enter source file path: ");
scanf("%s", path);
file = fopen(path, "r");
if (file == NULL){
printf("\nUnable to open file.\n");
exit(EXIT_FAILURE);
}
characters = words = lines = 0;
while ((ch = fgetc(file)) != EOF){
characters++;
if (ch == '\n' || ch == '\0')
lines++;
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\0')
words++;
}
if (characters > 0){
words++;
lines++;
}
printf("\n");
printf("Total characters = %d\n", characters);
printf("Total words = %d\n", words);
printf("Total lines = %d\n", lines);
fclose(file);
return 0;
}
Output
enter the text.press cntrl Z:
Hi welcome to Tutorials Point
C programming Articles
Best tutorial In the world
Try to have look on it
All The Best
Enter source file path: counting.txt

Total characters = 116


Total words = 23
Total lines = 6

Slip 6:-
Write a C program to create structure employee (id, name, salary). Accept
details of n employees and perform the following operations:
a. Display all employees.
b. Display details of all employees having salary > ____.

#include<stdio.h>

#include<stdlib.h>

struct details

char name[30];

int eid;
int salary;

}emp[5];

void emp_search(int r)

int id,i;

printf("\nEnter Employee-Id to be Searched : ");

scanf("%d",&id);

printf("----------------------------------------\n");

for(i=0;i<r;i++)

if(emp[i].eid==id)

printf("Employee Id : %d",emp[i].eid);

printf("\nName : %s",emp[i].name);

printf("\nSalary : %d\n",emp[i].salary);

void display(int r)

int i;

printf("\nList of All Employees:\n");

printf("-------------------------------\n");

printf("Emp-Id\tEmp-Name Salary\n");

printf("--------------------------------\n");
for(i=0;i<r;i++)

printf("%d\t%s\t %d\n",emp[i].eid,emp[i].name,emp[i].salary);

void greater(int r)

int i;

printf("\nDetails of Employee Whose Salary > 10000\n");

printf("------------------------------------------------");

for(i=0;i<r;i++)

if(emp[i].salary>10000)

printf("\n Employee Name : %s",emp[i].name);

printf("\n Employee-Id : %d",emp[i].eid);

printf("\n Salary : %d\n",emp[i].salary);

int main()

int n,i,ch;

printf("/*How Many Employee Record You Want to Add*/\n\nEnter Limit : ");

scanf("\n %d",&n);
for(i=0;i<n;i++)

printf("-----------------------------------------");

printf("\n\tEnter Details of Employee-%d",i+1);

printf("\n-----------------------------------------");

printf("\nName of Employee : ");

scanf("%s",emp[i].name);

printf("Employee-Id : ");

scanf("%d",&emp[i].eid);

printf("Salary : ");

scanf("%d",&emp[i].salary);

while(1)

printf("-----------------------------------------\n");

printf("\t\tMenu\n");

printf("-----------------------------------------");

printf("\n 1:Search Employee by E-ID");

printf("\n 2:List of All Employee");

printf("\n 3:Display Employee Name whose Salary > 10000 ");

printf("\n 4:Exit");

printf("\n----------------------------------------\n");

printf("Enter Your Choice : ");

scanf("\n %d",&ch);

switch(ch)
{

case 1: emp_search(n);

break;

case 2: display(n);

break;

case 3: greater(n);

break;

case 4: exit(0);

return 0;

Slip 7:-

Write a C program to accept n elements using dynamic memory allocation


and calculate the sum and average of the elements. Also find the largest
element.

Sol:

#include <stdio.h>
#include <stdlib.h>

int main() {

int n;
double *data;
printf("Enter the total number of elements: ");
scanf("%d", &n);

// Allocating memory for n elements


data = (double *)calloc(n, sizeof(double));
if (data == NULL) {
printf("Error!!! memory not allocated.");
exit(0);
}

// Storing numbers entered by the user.


for (int i = 0; i < n; ++i) {
printf("Enter number%d: ", i + 1);
scanf("%lf", data + i);
}

// Finding the largest number


for (int i = 1; i < n; ++i) {
if (*data < *(data + i)) {
*data = *(data + i);
}
}
printf("Largest number = %.2lf", *data);

free(data);

return 0;
}
Run Code

Output

Enter the total number of elements: 5


Enter number1: 3.4
Enter number2: 2.4
Enter number3: -5
Enter number4: 24.2
Enter number5: 6.7
Largest number = 24.20
Slip 8:-

Write a C program to accept details of n items (code, name, price) using


structure. Perform the following operations:
a. Display all items having price > ___
b. Search for an item by name.

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct item
{
int code;
char name[30];
float price;
};
int main()
{
struct item p[50];
int n,i,ch;
char key_name[30];
printf("\n Enter how many items? ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n\n Enter item code%d ",i+1);
scanf("%d",&p[i].code);
printf("\n Enter item name%d",i+1);
scanf("%s",p[i].name);
printf("\n Enter price%d",i+1);
scanf("%f",&p[i].price);
}
printf("\n\n 1. Display all items having price greater
than 250");
printf("\n 2. Search item\n 3. Exit");
printf("\nEnter your choice (1-3) : ");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("\n\n Details of Items are:");
for(i=0;i<n;i++)
{
if(p[i].price>250)
{
printf("\n\n Item code : %d",p[i].code);
printf("\n Item name : %s",p[i].name);
printf("\n Item price : %f",p[i].price);
}
}
break;
case 2: printf("\n Enter name to search : ");
scanf("%s",key_name);
for(i=0;i<n;i++)
{
if(strcmp(p[i].name,key_name)==0)
{
printf("\n\n Details of Item are :");
printf("\n Item code : %d ",p[i].code);
printf("\n Item name : %s",p[i].name);
printf(" \n Item Price : %f",p[i].price);
}
}
break;
case 3: exit(0);
break;
default : printf("\n Invalid input...");
}
return 0;
}

Slip 9:-

Write a C program to create a structure named student that accepts student


rollno, name and marks of 3 subjects. Calculate the total of marks and
percentage. Create an array of structures to enter information for n
students and display the details.

Solution

#include <stdio.h>
struct student {
char firstName[50];
int roll;
float marks;
} s[5];

int main() {
int i;
printf("Enter information of students:\n");

// storing information
for (i = 0; i < 5; ++i) {
s[i].roll = i + 1;
printf("\nFor roll number%d,\n", s[i].roll);
printf("Enter first name: ");
scanf("%s", s[i].firstName);
printf("Enter marks: ");
scanf("%f", &s[i].marks);
}
printf("Displaying Information:\n\n");

// displaying information
for (i = 0; i < 5; ++i) {
printf("\nRoll number: %d\n", i + 1);
printf("First name: ");
puts(s[i].firstName);
printf("Marks: %.1f", s[i].marks);
printf("\n");
}
return 0;
}

Slip 10:-

Write C program to copy contents of one file to another by changing case


of each alphabet and replacing digits by *

Sol-

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main()
{
FILE *fp1, *fp2;
char ch;
fp1 = fopen("source.txt", "r");
if (fp1 == NULL)
{
puts("File does not exist..");
exit(1);
}
fp2 = fopen("target.txt", "w");
if (fp2 == NULL)
{
puts("File does not exist..");
fclose(fp1);
exit(1);
}
while((ch=fgetc(fp1))!=EOF)
{
ch = toupper(ch);
fputc(ch,fp2);
}
printf("\nFile successfully copied..");
return 0;
}

Slip 11

Write a program to accept details of n employees (id, name, salary). Display all the details. Also, search
for an employee by name.

Solution:

#include<stdio.h>
#include<conio.h>
struct emp
{
int id,salary;
char name[20];
}e[100];

//To accept employee details


void accept(int n)
{
printf("\nEnter employee id: ");
scanf("%d",&e[n].id);
printf("\nEnter employee name: ");
scanf("%s",e[n].name);
printf("\nEnter employee salary: ");
scanf("%d",&e[n].salary);
}

//To display employee details


void display(int n)
{
printf("\nemployee id:\t\t%d",e[n].id);
printf("\nName:\t\t\t%s",e[n].name);
printf("\nsalary:\t\t\t%d\n",e[n].salary);
}

void main()
{
int c,n,i,Id; //c=choice , n=number of employees , Id=employee id
do
{
printf("\n1.Accept Details\n2.Display Details\n3.Search Employee by Id \n4.Exit\nEnter
your choice:");
scanf("%d",&c);
switch(c)
{
case 1:printf("Enter the number of employees:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
accept(i);
}
break;
case 2:printf("\n===============Details of employees=====================\
n");
for(i=0;i<n;i++)
{
display(i);
}
break;
case 3: printf("Enter the employee Id: ");
scanf("%d",&Id);
for(i=0;i<n;i++)
{
if(Id==e[i].id)
{
display(i);
break;
}
}
}
}while(c<4);
}

Slip 12
Write a C program to create a structure named book (book_name, author_name and price) and display
all book details having price > ____ in a proper format by passing the structure array as function
argument.
Solution:

#include<stdio.h>

#include<conio.h>

#include<string.h>

#define SIZE 20

struct bookdetail

{
char name[20];

char author[20];

int pages;

float price;

};

void output(struct bookdetail v[],int n);

void main()

struct bookdetail b[SIZE];

int n,i;

clrscr();

printf("Enter the Numbers of Books:");

scanf("%d",&n);

printf("\n");

for(i=0;i<n;i++)

printf("\t=:Book %d Detail:=\n",i+1);

printf("\nEnter the Book Name:\n");

scanf("%s",b[i].name);

printf("Enter the Author of Book:\n");


scanf("%s",b[i].author);

printf("Enter the Pages of Book:\n");

scanf("%d",&b[i].pages);

printf("Enter the Price of Book:\n");

scanf("%f",&b[i].price);

output(b,n);

getch();

void output(struct bookdetail v[],int n)

int i,t=1;

for(i=0;i<n;i++,t++)

printf("\n");

printf("Book No.%d\n",t);

printf("\t\tBook %d Name is=%s \n",t,v[i].name);

printf("\t\tBook %d Author is=%s \n",t,v[i].author);

printf("\t\tBook %d Pages is=%d \n",t,v[i].pages);

printf("\t\tBook %d Price is=%f \n",t,v[i].price);


printf("\n");

}
Slip 13
#include <stdio.h>

#include <string.h>

int main()

char str[100], ch;

int i, Flag;

Flag = 0;

printf("\n Please Enter any String : ");

gets(str);

printf("\n Please Enter the Character that you want to Search for : ");

scanf("%c", &ch);

for(i = 0; i <= strlen(str); i++)

{
if(str[i] == ch)

Flag++;

break;

if(Flag == 0)

printf("\n Sorry!! We haven't found the Search Character '%c' ", ch);

else

printf("\n The First Occurrence of the Search Element '%c' is at Position


%d ", ch, i + 1);

return 0;

Slip 14
Accept details of n students (roll no, name, percentage) using structure.
Write a menu driven program for the following:
a. Display all students
b. Display all students having percentage > ___
solution
1. #include<stdio.h>
2. #include<string.h>
3.
4. struct student
5. {
6. int roll_no,math,fileo,proc;
7. char name[20];
8. float percent;
9. };
10.
11. void Search(struct student S[],int size);
12. void Modify(struct student S[],int size,int
roll_no);
13. void DisplayAll(struct student S[],int
size);
14. void PercentGT(struct student S[],float
checkPercent,int size);
15. void MaxPercent(struct student S[],int
size);
16.
17. void main()
18. {
19. struct student S[200];
20. int i,roll_no,size,ope;
21. float checkPercent;
22.
23. printf("\n How many students are there:-
");
24. scanf(" %d",&size);
25.
26. printf("\n Enter the information of
students as follow:- \n \n");
27. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \n \
n");
28.
29. for(i=0;i<size;i++)
30. {
31. scanf(" %d %s %d %d
%d",&S[i].roll_no,S[i].name,&S[i].math,&S[i].fil
eo,&S[i].proc);
32.
S[i].percent=(S[i].math+S[i].fileo+S[i].proc)/3;
33. }
34.
35. do{
36. printf("\n \t ***** Menu *****");
37. printf("\n 1.Search");
38. printf("\n 2.Modify");
39. printf("\n 3.Display all student
details");
40. printf("\n 4.Display all students having
percentage greater than ___");
41. printf("\n 5.Display student having
maximum percentage");
42. printf("\n 6.Exit \n \n");
43. printf("\n Enter Your Choice:- ");
44. scanf(" %d",&ope);
45.
46. switch(ope)
47. {
48. case 1:
49. Search(S,size);
50. break;
51.
52. case 2:
53. printf("\n Enter roll no to modify the
details:- ");
54. scanf(" %d",&roll_no);
55. Modify(S,size,roll_no);
56. break;
57.
58. case 3:
59. DisplayAll(S,size);
60. break;
61.
62. case 4:
63. printf("\n Enter percentage:- ");
64. scanf("%f",&checkPercent);
65. PercentGT(S,checkPercent,size);
66. break;
67.
68. case 5:
69. MaxPercent(S,size);
70. break;
71. }}while(ope!=6);
72.
73. }
74.
75. void Search(struct student S[],int size)
76. {
77. char name[20];
78. int i,flg=0,roll_no,searchBy;
79.
80. do{
81. printf("\n How do you want to search:-
1.By Roll No \n \t\t\t 2.By Name \n");
82. scanf(" %d",&searchBy);
83.
84. if(searchBy==1)
85. {
86. printf("\n Enter roll no of the
student:- ");
87. scanf(" %d",&roll_no);
88. }
89. else
90. {
91. printf("\n Enter the name of the
student:- ");
92. scanf(" %s",name);
93. }}while(searchBy<1 || searchBy>2);
94.
95. for(i=0;i<size;i++)
96. {
97. if(S[i].roll_no==roll_no ||
strcmp(S[i].name,name)==0)
98. {
99. flg=1;
100. break;
101. }
102. }
103.
104. if(flg==1)
105. {
106. printf("\n We have found this result:- \
n ");
107. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \t
Percentage \n \n");
108. printf("\n %d \t\t %s \t %6d \t\t %1d \
t\t %8d \t\t %f \
n",S[i].roll_no,S[i].name,S[i].math,S[i].fileo,S
[i].proc,S[i].percent);
109. }
110. else
111. printf("\n We haven't found any record \
n \n");
112. }
113.
114. // Modify Function
115. void Modify(struct student S[],int size,int
roll_no)
116. {
117. char name[20];
118. int i,update,newData;
119.
120. do{
121. printf("\n What do you want to update:-
1.Roll NO \n \t\t\t 2.Name \n \t\t\t
3.Marks of 'Mathematics' \n \t\t\t 4.Marks
of 'File Organisation' \n \t\t\t 5.Marks of
'Programming in C' \n");
122. scanf(" %d",&update);
123.
124. if(update==3 || update==4 || update==5)
125. {
126. printf("\n Enter new marks:- ");
127. scanf("%d",&newData);
128. }
129. else if(update==1)
130. {
131. printf("\n Enter new roll no:- ");
132. scanf(" %d",&newData);
133. }
134. else if(update==2)
135. {
136. printf("\n Enter new name:- ");
137. scanf(" %s",name);
138. }
139. else
140. {
141. printf("\n Please make a valid choice \n
\n");
142. }
143.
144. }while(update<1 || update>5);
145.
146. for(i=0;i<size;i++)
147. {
148. if(S[i].roll_no==roll_no)
149. {
150. if(update==1)
151. {
152. S[i].roll_no=newData;
153. break;
154. }
155. else if(update==3)
156. {
157. S[i].math=newData;
158. break;
159. }
160. else if(update==4)
161. {
162. S[i].fileo=newData;
163. break;
164. }
165. else if(update==5)
166. {
167. S[i].proc=newData;
168. break;
169. }
170. else
171. {
172. strcpy(S[i].name,name);
173. break;
174. }
175. }
176. }
177.
178. printf("\n Modified details of students
are as follows:- \n");
179. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \t
Percentage \n \n");
180. for(i=0;i<size;i++)
181. {
182. printf("\n %d \t\t %s \t %6d \t\t %1d \
t\t %8d \t\t %f \
n",S[i].roll_no,S[i].name,S[i].math,S[i].fileo,S
[i].proc,S[i].percent);
183. }
184. }
185.
186. // DisplayAll Function
187. void DisplayAll(struct student S[200],int
size)
188. {
189. int i;
190.
191. printf("\n The Information of students
is as follow:- \n \n");
192. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \t
Percentage \n \n");
193.
194. for(i=0;i<size;i++)
195. printf("\n %d \t\t %s \t %6d \t\t %1d \
t\t %8d \t\t %f \
n",S[i].roll_no,S[i].name,S[i].math,S[i].fileo,S
[i].proc,S[i].percent);
196. }
197.
198. // PercentGT Function
199. void PercentGT(struct student S[],float
checkPercent,int size)
200. {
201. int i;
202.
203. printf("\n The Information of students
who scored percentage>%f :- \n \
n",checkPercent);
204. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \t
Percentage \n \n");
205.
206. for(i=0;i<size;i++)
207. {
208. if(S[i].percent>checkPercent)
209. {
210. printf("\n %d \t\t %s \t %6d \t\t
%1d \t\t %8d \t\t %f \
n",S[i].roll_no,S[i].name,S[i].math,S[i].fileo,S
[i].proc,S[i].percent);
211. }
212. }
213. }
214.
215. // MaxPercent Function
216. void MaxPercent(struct student S[200],int
size)
217. {
218. int i;
219. float maxPercent=S[0].percent;
220.
221. for(i=0;i<size;i++)
222. if(S[i].percent>maxPercent)
223. {
224. maxPercent=S[i].percent;
225. break;
226. }
227.
228. printf("\n \"%s\" scored maximum
percentage. Below are his details:- - \n
",S[i].name);
229. printf("\n Roll No\t Name \t Mathematics
\t File Organisation \t Programming In C \t
Percentage \n \n");
230. printf("\n %d \t\t %s \t %6d \t\t %1d \
t\t %8d \t\t %f \
n",S[i].roll_no,S[i].name,S[i].math,S[i].fileo,S
[i].proc,S[i].percent);
231.
232.
233. }
Slip 15
Write a C program to copy the contents of one text file to another such
that uppercase alphabets are converted to lowercase, lowercase to
uppercase and digits are converted to *.

Solution
1. #include <stdio.h>
2. #include <conio.h>
3. int main ()
4. {
5. char upr, lwr; // declare variables
6. int ascii;
7.
8. // convert in lower case
9. printf (" Enter the Upper Case Character: ");
10. scanf (" %c", &upr);
11. ascii = upr + 32;
12. printf (" %c character in Lower case is: %c", upr, ascii);
13.
14. // convert in upper case
15. printf (" \n Enter the Lower Case Character: ");
16. scanf (" %c", &lwr);
17. ascii = lwr - 32;
18. printf (" %c character in the Upper case is: %c", lwr, ascii);
19.
20. return 0;
21. }

You might also like