SlideShare a Scribd company logo
1 of 14
MIDTERM EXAM FOR
PROGRAMMING 2
Batch 3
Design a program that will accept
a maximum of 5 customers.
If your choice is 1: -------------- void ADD()
First name:
• printf("FIRST NAME:"); scanf("%s",&name[x]); getchar();
Name of item:
• printf(“ITEM NAME:"); scanf("%s",&item[x]); getchar();
Price:
• printf("PRICE:"); scanf("%d",&price[x]);
Quantity:
• printf("QUANTITY:"); scanf("%d",&qty[x]);
• Clear the previous display ----------------- clrscr();
• Accept the following:
Then compute for total amount,
where total amount is:
price * quantity.
• totalAmt[x]=price[x]*qty[x];
• If total amount is lesser than or equal to 1000, give 5% discount.
Compute for total discounted amount, where:
Total Discounted Amount is Total Amount – Discounted Amount.
Display Total Discounted Amount.
• Else if total amount is greater than 1000, but less than or equal to 2000,
give 10% discount. Compute for total discounted amount, where:
Total Discounted Amount is Total Amount – Discounted Amount.
Display Total Discounted Amount.
• Else if total amount is greater than 2000, but less than 5000, give 15%
discount. Compute for total discounted amount, where:
Total Discounted Amount is Total Amount – Discounted Amount.
Display Total Discounted Amount.
• Else give 20% discount. Compute for total discounted amount, where:
Total Discounted Amount is Total Amount – Discounted Amount.
Display Total Discounted Amount
If (totalAmt[x]<=1000)
{ dc[x] = totalAmt[x] * 0.05;
disc[x] = totalAmt[x] - dc[x];
printf ("TOTAL DISCOUNTED AMOUNT: %f", disc[x]); }
else if (totalAmt[x]>1000 && totalAmt[x]<=2000)
{ dc[x] = totalAmt[x] * 0.10;
disc[x] = totalAmt[x] - dc[x];
printf ("TOTAL DISCOUNTED AMOUNT: %f", disc[x]); }
else if (totalAmt[x]>2000&&totalAmt[x]<5000)
{ dc[x] = totalAmt[x] * 0.15;
disc[x] = totalAmt[x] - dc[x];
printf ("TOTAL DISCOUNTED AMOUNT: %f",disc[x]); }
else
{ dc[x] = totalAmt[x] * 0.20;
disc[x] = totalAmt[x] - dc[x];
printf ("TOTAL DISCOUNTED AMOUNT: %f",disc[x]); }
After all the inputs, ask “DO YOU
WANT TO GO TO MAIN MENU? 1
for YES | 2 for NO”…
• If 1 go to Main Menu or Main Display
 if(opt==1) { MAIN(); }
• If 2 Exit
 else { exit(0);}
If your choice is 2: -------------- void EDIT()
• Clear the previous display ----------------- clrscr();
• Display “NO RECORDS AVAILABLE” if no information of
entrepreneurs that were added.
• Else, display all information of customer.
• If you wish to edit the information of customer, display “DO
YOU WANT TO EDIT INFORMATION?
1 for YES | 2 for NO”
• If you entered 1, accept a number from list you want to edit.
Display EDIT MENU.
• Choose what field of information you would like to edit.
• If your choice is 1, then EDIT the FIRST NAME only
• If your choice is 2, EDIT the ITEM NAME
• If your choice is 3, EDIT the QUANTITY
• If your choice is 4, EDIT the PRICE
• After all the inputs, ask “DO YOU WANT TO GO TO MAIN
MENU? 1 for YES | 2 for NO…
• If 1 go to Main Menu or Main Display
 if(opt==1) { MAIN(); }
• If 2 Exit
 else { exit(0);}
EDIT INFORMATION
FIRST NAME ITEM QUANTITY PRICE TOTAL AMOUNT TOTAL DISCOUNTED AMOUNT
1. Khatt bag 2 950 19,000 18,620
2. Jenny pen 5 100 500 495
Do you want to edit information? 1 for YES | 2 for NO: 1
Enter a number from the list: 1
Choose what field to edit:
• FIRST NAME
• NAME OF ITEM
• QUANTITY
• PRICE
ENTER YOUR CHOICE: 1
************************** EDIT CUSTOMER’S INFORMATION ************************
ENTER FIRST NAME: firstname
Do you want to go to Main Menu? 1 for YES | 2 for NO:
void EDIT()
{ clrscr();
if(x==0)
{ printf("NO RECORDS AVAILABLE!"); }
else
{ printf("ALL INFORMATION of CUSTOMER");
printf("FIRST NAME ITEM QTY PRICE AMOUNT DISCOUNTED AMT");
for (y=1; y<=x; y++)
{
printf("%d. %s %s %d %d %d %f",y, name[y],item[y],qty[y],price[y],totalAmt[y],disc[y]); }
printf("DO YOU WANT TO EDIT INFORMATION? 1 for YES | 2 for NO:");scanf("%d",&num);
if(num==1)
{ printf ("ENTER A NUMBER FROM THE LIST: "); scanf("%d",&number);
printf (“ CHOOSE WHAT FIELD TO EDIT:");
printf (“ 1. FIRST NAME");
printf (“ 2. NAME OF ITEM");
printf (“ 3. QUANTITY");
printf (“ 4. PRICE");
printf (" ENTER YOUR CHOICE: "); scanf("%d",&ch);
switch(ch)
switch(ch)
{ clrscr();
case 1: printf (“ ENTER FIRST NAME:"); scanf("%s",&name[number]); getchar();
break;
case 2: printf (“ ENTER NAME OF ITEM:"); scanf("%s",&item[number]); getchar();
break;
case 3: printf (“ ENTER QUANTITY:"); scanf("%d",&qty[number]);
break;
case 4: printf (“ ENTER PRICE:"); scanf("%d",&price[number]);
break;
}
printf("DO YOU WANT TO GO TO MAIN? 1 for YES | 2 for NO:");scanf("%d",&opt);
if(opt==1)
{ MAIN(); }
else { exit(0); }
else
{ exit(0); }
}}
If your choice is 3: -------------- void Display()
• Clear the previous display ----------------- clrscr();
• Display “NO RECORDS AVAILABLE” if no information of
entrepreneurs that were added.
• Else, display all information of customer.
• If you wish to edit the information of customer, display “DO
YOU WANT TO EDIT INFORMATION?
1 for YES | 2 for NO”
• If 1 go to Main Menu or Main Display
 if(opt==1) { MAIN(); }
• If 2 Exit
 else { exit(0);}
void Display()
{
clrscr();
printf("DISPLAY INFORMATION");
if(x==0)
{ printf (“NO RECORDS AVAILABLE!"); }
else
{
printf (“ FIRST NAME ITEM QTY PRICE AMOUNT DISCOUNTED AMT");
for (y=1; y<=x; y++)
{
printf("%d. %s %s %d %d %d %f",y, name[y],item[y],qty[y],price[y],totalAmt[y],disc[y]); }
printf(" DO YOU WANT TO GO TO MAIN? 1 for YES, 2 for EXIT: ");
scanf("%d",&opt);
if(opt==1)
{ MAIN(); }
else
{ exit(0); }
}}

More Related Content

What's hot

2 3. standard io
2 3. standard io2 3. standard io
2 3. standard io
웅식 전
 

What's hot (13)

DS- Stack ADT
DS- Stack ADTDS- Stack ADT
DS- Stack ADT
 
Structured query language functions
Structured query language functionsStructured query language functions
Structured query language functions
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Array list
Array listArray list
Array list
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
Visual Basic
Visual BasicVisual Basic
Visual Basic
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4
 
Sas reg multi
Sas reg multiSas reg multi
Sas reg multi
 
LET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERS
 
2 3. standard io
2 3. standard io2 3. standard io
2 3. standard io
 
The Ring programming language version 1.6 book - Part 44 of 189
The Ring programming language version 1.6 book - Part 44 of 189The Ring programming language version 1.6 book - Part 44 of 189
The Ring programming language version 1.6 book - Part 44 of 189
 
TI-84 graphing calculator guide
TI-84 graphing calculator guideTI-84 graphing calculator guide
TI-84 graphing calculator guide
 
Class program and uml in c++
Class program and uml in c++Class program and uml in c++
Class program and uml in c++
 

Viewers also liked

Final slide presentation
Final slide presentationFinal slide presentation
Final slide presentation
AlfredoAGarcia
 

Viewers also liked (9)

IOS 4: Multitasking
IOS 4: MultitaskingIOS 4: Multitasking
IOS 4: Multitasking
 
Project presentation
Project presentationProject presentation
Project presentation
 
Final slide presentation
Final slide presentationFinal slide presentation
Final slide presentation
 
GEB Final Presentation with Sound
GEB Final Presentation with SoundGEB Final Presentation with Sound
GEB Final Presentation with Sound
 
ระบบกระดูก
ระบบกระดูกระบบกระดูก
ระบบกระดูก
 
ทุเรียน
ทุเรียนทุเรียน
ทุเรียน
 
อินเดีย
อินเดียอินเดีย
อินเดีย
 
อเมริกาเหนือ ทรัพยากรและสิ่งแวดล้อมใหม่
อเมริกาเหนือ ทรัพยากรและสิ่งแวดล้อมใหม่อเมริกาเหนือ ทรัพยากรและสิ่งแวดล้อมใหม่
อเมริกาเหนือ ทรัพยากรและสิ่งแวดล้อมใหม่
 
วัฒนธรรม กับ ภาษาของมนุษย์
วัฒนธรรม กับ ภาษาของมนุษย์วัฒนธรรม กับ ภาษาของมนุษย์
วัฒนธรรม กับ ภาษาของมนุษย์
 

Similar to Computer Programming Code Sample

CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
TasnimSaimaRaita
 
cafeteria info management system
cafeteria info management systemcafeteria info management system
cafeteria info management system
Gaurav Subham
 
I really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdfI really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdf
pasqualealvarez467
 
C programs
C programsC programs
C programs
Minu S
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
Amit Singh
 

Similar to Computer Programming Code Sample (20)

ch03-parameters-objects.ppt
ch03-parameters-objects.pptch03-parameters-objects.ppt
ch03-parameters-objects.ppt
 
C programs Set 4
C programs Set 4C programs Set 4
C programs Set 4
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
cafeteria info management system
cafeteria info management systemcafeteria info management system
cafeteria info management system
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
 
array
arrayarray
array
 
I really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdfI really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdf
 
array.ppt
array.pptarray.ppt
array.ppt
 
Moving Average Filter in C
Moving Average Filter in CMoving Average Filter in C
Moving Average Filter in C
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
C programs
C programsC programs
C programs
 
design and analysis of algorithm Lab files
design and analysis of algorithm Lab filesdesign and analysis of algorithm Lab files
design and analysis of algorithm Lab files
 
Operating system labs
Operating system labsOperating system labs
Operating system labs
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Computer Programming Code Sample

  • 2. Batch 3 Design a program that will accept a maximum of 5 customers.
  • 3. If your choice is 1: -------------- void ADD() First name: • printf("FIRST NAME:"); scanf("%s",&name[x]); getchar(); Name of item: • printf(“ITEM NAME:"); scanf("%s",&item[x]); getchar(); Price: • printf("PRICE:"); scanf("%d",&price[x]); Quantity: • printf("QUANTITY:"); scanf("%d",&qty[x]); • Clear the previous display ----------------- clrscr(); • Accept the following:
  • 4. Then compute for total amount, where total amount is: price * quantity. • totalAmt[x]=price[x]*qty[x];
  • 5. • If total amount is lesser than or equal to 1000, give 5% discount. Compute for total discounted amount, where: Total Discounted Amount is Total Amount – Discounted Amount. Display Total Discounted Amount. • Else if total amount is greater than 1000, but less than or equal to 2000, give 10% discount. Compute for total discounted amount, where: Total Discounted Amount is Total Amount – Discounted Amount. Display Total Discounted Amount. • Else if total amount is greater than 2000, but less than 5000, give 15% discount. Compute for total discounted amount, where: Total Discounted Amount is Total Amount – Discounted Amount. Display Total Discounted Amount. • Else give 20% discount. Compute for total discounted amount, where: Total Discounted Amount is Total Amount – Discounted Amount. Display Total Discounted Amount
  • 6. If (totalAmt[x]<=1000) { dc[x] = totalAmt[x] * 0.05; disc[x] = totalAmt[x] - dc[x]; printf ("TOTAL DISCOUNTED AMOUNT: %f", disc[x]); } else if (totalAmt[x]>1000 && totalAmt[x]<=2000) { dc[x] = totalAmt[x] * 0.10; disc[x] = totalAmt[x] - dc[x]; printf ("TOTAL DISCOUNTED AMOUNT: %f", disc[x]); } else if (totalAmt[x]>2000&&totalAmt[x]<5000) { dc[x] = totalAmt[x] * 0.15; disc[x] = totalAmt[x] - dc[x]; printf ("TOTAL DISCOUNTED AMOUNT: %f",disc[x]); } else { dc[x] = totalAmt[x] * 0.20; disc[x] = totalAmt[x] - dc[x]; printf ("TOTAL DISCOUNTED AMOUNT: %f",disc[x]); }
  • 7. After all the inputs, ask “DO YOU WANT TO GO TO MAIN MENU? 1 for YES | 2 for NO”… • If 1 go to Main Menu or Main Display  if(opt==1) { MAIN(); } • If 2 Exit  else { exit(0);}
  • 8. If your choice is 2: -------------- void EDIT() • Clear the previous display ----------------- clrscr(); • Display “NO RECORDS AVAILABLE” if no information of entrepreneurs that were added. • Else, display all information of customer. • If you wish to edit the information of customer, display “DO YOU WANT TO EDIT INFORMATION? 1 for YES | 2 for NO” • If you entered 1, accept a number from list you want to edit. Display EDIT MENU. • Choose what field of information you would like to edit.
  • 9. • If your choice is 1, then EDIT the FIRST NAME only • If your choice is 2, EDIT the ITEM NAME • If your choice is 3, EDIT the QUANTITY • If your choice is 4, EDIT the PRICE • After all the inputs, ask “DO YOU WANT TO GO TO MAIN MENU? 1 for YES | 2 for NO… • If 1 go to Main Menu or Main Display  if(opt==1) { MAIN(); } • If 2 Exit  else { exit(0);}
  • 10. EDIT INFORMATION FIRST NAME ITEM QUANTITY PRICE TOTAL AMOUNT TOTAL DISCOUNTED AMOUNT 1. Khatt bag 2 950 19,000 18,620 2. Jenny pen 5 100 500 495 Do you want to edit information? 1 for YES | 2 for NO: 1 Enter a number from the list: 1 Choose what field to edit: • FIRST NAME • NAME OF ITEM • QUANTITY • PRICE ENTER YOUR CHOICE: 1 ************************** EDIT CUSTOMER’S INFORMATION ************************ ENTER FIRST NAME: firstname Do you want to go to Main Menu? 1 for YES | 2 for NO:
  • 11. void EDIT() { clrscr(); if(x==0) { printf("NO RECORDS AVAILABLE!"); } else { printf("ALL INFORMATION of CUSTOMER"); printf("FIRST NAME ITEM QTY PRICE AMOUNT DISCOUNTED AMT"); for (y=1; y<=x; y++) { printf("%d. %s %s %d %d %d %f",y, name[y],item[y],qty[y],price[y],totalAmt[y],disc[y]); } printf("DO YOU WANT TO EDIT INFORMATION? 1 for YES | 2 for NO:");scanf("%d",&num); if(num==1) { printf ("ENTER A NUMBER FROM THE LIST: "); scanf("%d",&number); printf (“ CHOOSE WHAT FIELD TO EDIT:"); printf (“ 1. FIRST NAME"); printf (“ 2. NAME OF ITEM"); printf (“ 3. QUANTITY"); printf (“ 4. PRICE"); printf (" ENTER YOUR CHOICE: "); scanf("%d",&ch); switch(ch)
  • 12. switch(ch) { clrscr(); case 1: printf (“ ENTER FIRST NAME:"); scanf("%s",&name[number]); getchar(); break; case 2: printf (“ ENTER NAME OF ITEM:"); scanf("%s",&item[number]); getchar(); break; case 3: printf (“ ENTER QUANTITY:"); scanf("%d",&qty[number]); break; case 4: printf (“ ENTER PRICE:"); scanf("%d",&price[number]); break; } printf("DO YOU WANT TO GO TO MAIN? 1 for YES | 2 for NO:");scanf("%d",&opt); if(opt==1) { MAIN(); } else { exit(0); } else { exit(0); } }}
  • 13. If your choice is 3: -------------- void Display() • Clear the previous display ----------------- clrscr(); • Display “NO RECORDS AVAILABLE” if no information of entrepreneurs that were added. • Else, display all information of customer. • If you wish to edit the information of customer, display “DO YOU WANT TO EDIT INFORMATION? 1 for YES | 2 for NO” • If 1 go to Main Menu or Main Display  if(opt==1) { MAIN(); } • If 2 Exit  else { exit(0);}
  • 14. void Display() { clrscr(); printf("DISPLAY INFORMATION"); if(x==0) { printf (“NO RECORDS AVAILABLE!"); } else { printf (“ FIRST NAME ITEM QTY PRICE AMOUNT DISCOUNTED AMT"); for (y=1; y<=x; y++) { printf("%d. %s %s %d %d %d %f",y, name[y],item[y],qty[y],price[y],totalAmt[y],disc[y]); } printf(" DO YOU WANT TO GO TO MAIN? 1 for YES, 2 for EXIT: "); scanf("%d",&opt); if(opt==1) { MAIN(); } else { exit(0); } }}