SlideShare a Scribd company logo
1 of 2
Hello! Can I plz have this in C? This is the second time I submit this question. There are too
many versions not workingin the internet. Can I have a different one that is working?
Thank you!
Write a function that verifies if a given number exists in an array of floats. The function is
supposed to return the first position in where the number is encountered. If the given number
does not exist, the function returns –1.
Then write a program that asks the user to enter an array of floats and calls the function.
The prototype of the function should be like:
int Search (floats a[ ] , int n, float number)
Example:
Consider the following array of floats
2.1Â Â Â Â Â Â 1 9 -14Â Â Â Â Â 17.3Â Â Â 5.9 9 17
0Â Â Â Â Â Â Â Â Â 1 2 3Â Â Â Â Â Â Â Â Â 4Â Â Â Â Â Â Â Â Â
5Â Â Â Â Â Â Â Â Â 6Â Â Â Â Â Â Â Â Â 7
If the number to be searched is 5.4 the function returns –1
If the number to be searched is 9 the function returns 2
Solution
Answer
#include <stdio.h>
int Search(float a[ ],int n,float number)
{
int i,loc=-1;
for(i=0;i<n;i++)
{
if(a[i]==number)
{
loc=i;
break;
}
}
return loc;
}
int main(void)
{
int loc,n,i;
printf(" Enter array size : "); //input array size
scanf("%d",&n);
float arr[n],num;
printf(" Enter array :  "); //Input array of values
for(i=0;i<n;i++)
{
scanf("%f",&arr[i]);
}
printf(" Enter value to Search : "); //input of value to search
scanf("%f",&num);
loc=Search(arr,n,num); //Function call
printf(" Result : %d",loc);
return 0;
}

More Related Content

Similar to Hello! Can I plz have this in C- This is the second time I submit this.docx

ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxpriestmanmable
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014Nayden Gochev
 
JS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better PartsJS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better PartsJSFestUA
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonPriyankaC44
 
OODP UNIT 2 Function overloading
OODP UNIT 2 Function overloadingOODP UNIT 2 Function overloading
OODP UNIT 2 Function overloadingShanmuganathan C
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdfziyadaslanbey
 
Notes5
Notes5Notes5
Notes5hccit
 
Hub102 - JS - Lesson3
Hub102 - JS - Lesson3Hub102 - JS - Lesson3
Hub102 - JS - Lesson3Tiểu Hổ
 
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested LoopLoops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested LoopPriyom Majumder
 
Interview questions_mod.pdf
Interview questions_mod.pdfInterview questions_mod.pdf
Interview questions_mod.pdfRajb54
 
Interview questions
Interview questionsInterview questions
Interview questionsmaverick2203
 

Similar to Hello! Can I plz have this in C- This is the second time I submit this.docx (20)

ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Week 2.pptx
Week 2.pptxWeek 2.pptx
Week 2.pptx
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
 
JS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better PartsJS Fest 2018. Douglas Crockford. The Better Parts
JS Fest 2018. Douglas Crockford. The Better Parts
 
Presentation 2.pptx
Presentation 2.pptxPresentation 2.pptx
Presentation 2.pptx
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in Python
 
OODP UNIT 2 Function overloading
OODP UNIT 2 Function overloadingOODP UNIT 2 Function overloading
OODP UNIT 2 Function overloading
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
Notes5
Notes5Notes5
Notes5
 
Hub102 - JS - Lesson3
Hub102 - JS - Lesson3Hub102 - JS - Lesson3
Hub102 - JS - Lesson3
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
 
Python Homework Help
Python Homework HelpPython Homework Help
Python Homework Help
 
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested LoopLoops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
 
Interview questions_mod.pdf
Interview questions_mod.pdfInterview questions_mod.pdf
Interview questions_mod.pdf
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Interview questions
Interview questionsInterview questions
Interview questions
 
Interview questions
Interview questionsInterview questions
Interview questions
 
Unit - 2 CAP.pptx
Unit - 2 CAP.pptxUnit - 2 CAP.pptx
Unit - 2 CAP.pptx
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 

More from deant5

Hello- please use EULERS METHOD to solve and graph this- Please show -.docx
Hello- please use EULERS METHOD to solve and graph this- Please show -.docxHello- please use EULERS METHOD to solve and graph this- Please show -.docx
Hello- please use EULERS METHOD to solve and graph this- Please show -.docxdeant5
 
he above pictures best represents a solid lonic A) picture (a) B) pict.docx
he above pictures best represents a solid lonic A) picture (a) B) pict.docxhe above pictures best represents a solid lonic A) picture (a) B) pict.docx
he above pictures best represents a solid lonic A) picture (a) B) pict.docxdeant5
 
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docxHeidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docxdeant5
 
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docxHeidi Design acquired 20- of the outstanding common stock of Quigly Co.docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docxdeant5
 
Halogens tend to have high- I- electronegativities II- solublity in a.docx
Halogens tend to have high-  I- electronegativities II- solublity in a.docxHalogens tend to have high-  I- electronegativities II- solublity in a.docx
Halogens tend to have high- I- electronegativities II- solublity in a.docxdeant5
 
Heat transfer summary questionsSolutionThermal energy is related to th.docx
Heat transfer summary questionsSolutionThermal energy is related to th.docxHeat transfer summary questionsSolutionThermal energy is related to th.docx
Heat transfer summary questionsSolutionThermal energy is related to th.docxdeant5
 
he following accounts were taken from ABC CompanySolutionCalculation o.docx
he following accounts were taken from ABC CompanySolutionCalculation o.docxhe following accounts were taken from ABC CompanySolutionCalculation o.docx
he following accounts were taken from ABC CompanySolutionCalculation o.docxdeant5
 
he following accounts were taken from ABC CompanySolutionCalculation o (1).docx
he following accounts were taken from ABC CompanySolutionCalculation o (1).docxhe following accounts were taken from ABC CompanySolutionCalculation o (1).docx
he following accounts were taken from ABC CompanySolutionCalculation o (1).docxdeant5
 
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docx
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docxHarriet Pandel- an employer- is subject to FICA taxes but exempt from.docx
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docxdeant5
 
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docx
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docxHarris Fell- CPA and member of the AICPA- was engaged to audit the fin.docx
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docxdeant5
 
Gwen and Paul are deciding how to split their time between writing mus.docx
Gwen and Paul are deciding how to split their time between writing mus.docxGwen and Paul are deciding how to split their time between writing mus.docx
Gwen and Paul are deciding how to split their time between writing mus.docxdeant5
 
Gordon Corporation reported the following equity section on its curren.docx
Gordon Corporation reported the following equity section on its curren.docxGordon Corporation reported the following equity section on its curren.docx
Gordon Corporation reported the following equity section on its curren.docxdeant5
 
Goodwill would appear in which balance sheet section- a- Investments b.docx
Goodwill would appear in which balance sheet section- a- Investments b.docxGoodwill would appear in which balance sheet section- a- Investments b.docx
Goodwill would appear in which balance sheet section- a- Investments b.docxdeant5
 
1- A genetic map is a(an) set of identical copies of DNA segments from.docx
1- A genetic map is a(an) set of identical copies of DNA segments from.docx1- A genetic map is a(an) set of identical copies of DNA segments from.docx
1- A genetic map is a(an) set of identical copies of DNA segments from.docxdeant5
 
1- A buyout involving the target firms current management is called a.docx
1- A buyout involving the target firms current management is called a.docx1- A buyout involving the target firms current management is called a.docx
1- A buyout involving the target firms current management is called a.docxdeant5
 
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docxdeant5
 
1- (TCO 5) Which form type displays records in a tabular format simila.docx
1- (TCO 5) Which form type displays records in a tabular format simila.docx1- (TCO 5) Which form type displays records in a tabular format simila.docx
1- (TCO 5) Which form type displays records in a tabular format simila.docxdeant5
 
1- (TCO F) Which of the following is correct with respect to Internal.docx
1- (TCO F) Which of the following is correct with respect to Internal.docx1- (TCO F) Which of the following is correct with respect to Internal.docx
1- (TCO F) Which of the following is correct with respect to Internal.docxdeant5
 
1- (Learning Objective 2- Describe components of internal control) Lis.docx
1- (Learning Objective 2- Describe components of internal control) Lis.docx1- (Learning Objective 2- Describe components of internal control) Lis.docx
1- (Learning Objective 2- Describe components of internal control) Lis.docxdeant5
 
1)What are the advantages and disadvantages for MNEs to provide post-a.docx
1)What are the advantages and disadvantages for MNEs to provide post-a.docx1)What are the advantages and disadvantages for MNEs to provide post-a.docx
1)What are the advantages and disadvantages for MNEs to provide post-a.docxdeant5
 

More from deant5 (20)

Hello- please use EULERS METHOD to solve and graph this- Please show -.docx
Hello- please use EULERS METHOD to solve and graph this- Please show -.docxHello- please use EULERS METHOD to solve and graph this- Please show -.docx
Hello- please use EULERS METHOD to solve and graph this- Please show -.docx
 
he above pictures best represents a solid lonic A) picture (a) B) pict.docx
he above pictures best represents a solid lonic A) picture (a) B) pict.docxhe above pictures best represents a solid lonic A) picture (a) B) pict.docx
he above pictures best represents a solid lonic A) picture (a) B) pict.docx
 
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docxHeidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co (1).docx
 
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docxHeidi Design acquired 20- of the outstanding common stock of Quigly Co.docx
Heidi Design acquired 20- of the outstanding common stock of Quigly Co.docx
 
Halogens tend to have high- I- electronegativities II- solublity in a.docx
Halogens tend to have high-  I- electronegativities II- solublity in a.docxHalogens tend to have high-  I- electronegativities II- solublity in a.docx
Halogens tend to have high- I- electronegativities II- solublity in a.docx
 
Heat transfer summary questionsSolutionThermal energy is related to th.docx
Heat transfer summary questionsSolutionThermal energy is related to th.docxHeat transfer summary questionsSolutionThermal energy is related to th.docx
Heat transfer summary questionsSolutionThermal energy is related to th.docx
 
he following accounts were taken from ABC CompanySolutionCalculation o.docx
he following accounts were taken from ABC CompanySolutionCalculation o.docxhe following accounts were taken from ABC CompanySolutionCalculation o.docx
he following accounts were taken from ABC CompanySolutionCalculation o.docx
 
he following accounts were taken from ABC CompanySolutionCalculation o (1).docx
he following accounts were taken from ABC CompanySolutionCalculation o (1).docxhe following accounts were taken from ABC CompanySolutionCalculation o (1).docx
he following accounts were taken from ABC CompanySolutionCalculation o (1).docx
 
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docx
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docxHarriet Pandel- an employer- is subject to FICA taxes but exempt from.docx
Harriet Pandel- an employer- is subject to FICA taxes but exempt from.docx
 
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docx
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docxHarris Fell- CPA and member of the AICPA- was engaged to audit the fin.docx
Harris Fell- CPA and member of the AICPA- was engaged to audit the fin.docx
 
Gwen and Paul are deciding how to split their time between writing mus.docx
Gwen and Paul are deciding how to split their time between writing mus.docxGwen and Paul are deciding how to split their time between writing mus.docx
Gwen and Paul are deciding how to split their time between writing mus.docx
 
Gordon Corporation reported the following equity section on its curren.docx
Gordon Corporation reported the following equity section on its curren.docxGordon Corporation reported the following equity section on its curren.docx
Gordon Corporation reported the following equity section on its curren.docx
 
Goodwill would appear in which balance sheet section- a- Investments b.docx
Goodwill would appear in which balance sheet section- a- Investments b.docxGoodwill would appear in which balance sheet section- a- Investments b.docx
Goodwill would appear in which balance sheet section- a- Investments b.docx
 
1- A genetic map is a(an) set of identical copies of DNA segments from.docx
1- A genetic map is a(an) set of identical copies of DNA segments from.docx1- A genetic map is a(an) set of identical copies of DNA segments from.docx
1- A genetic map is a(an) set of identical copies of DNA segments from.docx
 
1- A buyout involving the target firms current management is called a.docx
1- A buyout involving the target firms current management is called a.docx1- A buyout involving the target firms current management is called a.docx
1- A buyout involving the target firms current management is called a.docx
 
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx
1- 2- 3- 5- Part B Constants- Periodic Table nteractive 3D display mod.docx
 
1- (TCO 5) Which form type displays records in a tabular format simila.docx
1- (TCO 5) Which form type displays records in a tabular format simila.docx1- (TCO 5) Which form type displays records in a tabular format simila.docx
1- (TCO 5) Which form type displays records in a tabular format simila.docx
 
1- (TCO F) Which of the following is correct with respect to Internal.docx
1- (TCO F) Which of the following is correct with respect to Internal.docx1- (TCO F) Which of the following is correct with respect to Internal.docx
1- (TCO F) Which of the following is correct with respect to Internal.docx
 
1- (Learning Objective 2- Describe components of internal control) Lis.docx
1- (Learning Objective 2- Describe components of internal control) Lis.docx1- (Learning Objective 2- Describe components of internal control) Lis.docx
1- (Learning Objective 2- Describe components of internal control) Lis.docx
 
1)What are the advantages and disadvantages for MNEs to provide post-a.docx
1)What are the advantages and disadvantages for MNEs to provide post-a.docx1)What are the advantages and disadvantages for MNEs to provide post-a.docx
1)What are the advantages and disadvantages for MNEs to provide post-a.docx
 

Recently uploaded

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
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).pptxEsquimalt MFRC
 
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.pptxDenish Jangid
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
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 POSCeline George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
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...Amil baba
 
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.docxRamakrishna Reddy Bijjam
 
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.pptxDr. Ravikiran H M Gowda
 
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.pdfNirmal Dwivedi
 

Recently uploaded (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
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
 
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
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
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
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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...
 
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
 
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
 

Hello! Can I plz have this in C- This is the second time I submit this.docx

  • 1. Hello! Can I plz have this in C? This is the second time I submit this question. There are too many versions not workingin the internet. Can I have a different one that is working? Thank you! Write a function that verifies if a given number exists in an array of floats. The function is supposed to return the first position in where the number is encountered. If the given number does not exist, the function returns –1. Then write a program that asks the user to enter an array of floats and calls the function. The prototype of the function should be like: int Search (floats a[ ] , int n, float number) Example: Consider the following array of floats 2.1      1 9 -14     17.3   5.9 9 17 0         1 2 3         4         5         6         7 If the number to be searched is 5.4 the function returns –1 If the number to be searched is 9 the function returns 2 Solution Answer #include <stdio.h> int Search(float a[ ],int n,float number) { int i,loc=-1;
  • 2. for(i=0;i<n;i++) { if(a[i]==number) { loc=i; break; } } return loc; } int main(void) { int loc,n,i; printf(" Enter array size : "); //input array size scanf("%d",&n); float arr[n],num; printf(" Enter array : "); //Input array of values for(i=0;i<n;i++) { scanf("%f",&arr[i]); } printf(" Enter value to Search : "); //input of value to search scanf("%f",&num); loc=Search(arr,n,num); //Function call printf(" Result : %d",loc); return 0; }