SlideShare ist ein Scribd-Unternehmen logo
1 von 2
1. develop a C program to print the sum, the average, the product, the largest and the smallest of
3 integers that are input from the keyboard.
2. define an array x of size 5, using call-by-reference (that is, use pointer) to pass the array to a
function, named summation.
In main: define array, print out the array, pass the array and show the results on screen.
In function summation: take arrays from main and sum the arrays using the formula below
sum=4summation0 xi*xi
Solution
#include <stdio.h>
#include<conio.h>
void summation(int a[],int size)
{
int i;
int sum = 0;
for(i=0;i<size;i++)
{
sum = sum+ 4*a[i]*a[i];
}
printf(" Summation is %d",sum);
}
int main(void) {
// your code goes here
int a,size;
int b[] = {1,2,3};
int i =0,max = 0,min =0 ,sum = 0 ,product = 1,average = 0 ;
for(i=0;i<3;i++)
{
printf("Enter the value of %d number",i+1);
scanf("%d",&a);
if(i==0)
min = a;
sum =sum+a;
product = product*a;
if(a>=max)
max = a;
if(a<=min)
min = a;
}
average = sum/3;
printf("Sum is %d Product is %d average is %d max is %d min is %d
",sum,product,average,max,min);
size = sizeof(b)/sizeof(b[1]);
printf("Array Content ");
for(i=0;i<size;i++)
{
printf ("%d ",b[i]);
}
summation(b,size);
getch();
return 0;
}

Weitere ähnliche Inhalte

Ähnlich wie 1- develop a C program to print the sum- the average- the product- the.docx

B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programsPrasadu Peddi
 
Write a C code to perform the following tasks In main Define an arr.pdf
Write a C code to perform the following tasks In main Define an arr.pdfWrite a C code to perform the following tasks In main Define an arr.pdf
Write a C code to perform the following tasks In main Define an arr.pdffabmallkochi
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1Zaibi Gondal
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfAshutoshprasad27
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxAshutoshprasad27
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxgerardkortney
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptDeepak Singh
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)Make Mannan
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
 

Ähnlich wie 1- develop a C program to print the sum- the average- the product- the.docx (20)

B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
Write a C code to perform the following tasks In main Define an arr.pdf
Write a C code to perform the following tasks In main Define an arr.pdfWrite a C code to perform the following tasks In main Define an arr.pdf
Write a C code to perform the following tasks In main Define an arr.pdf
 
10 template code program
10 template code program10 template code program
10 template code program
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 
Functions
FunctionsFunctions
Functions
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
Functions in c
Functions in cFunctions in c
Functions in c
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory Concept
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
C Programming
C ProgrammingC Programming
C Programming
 

Mehr von jbarbara1

1- Define computer crime and list several examples of computer crime-.docx
1- Define computer crime and list several examples of computer crime-.docx1- Define computer crime and list several examples of computer crime-.docx
1- Define computer crime and list several examples of computer crime-.docxjbarbara1
 
1- Create a Visual Calculator by using winform application in Microsof.docx
1- Create a Visual Calculator by using winform application in Microsof.docx1- Create a Visual Calculator by using winform application in Microsof.docx
1- Create a Visual Calculator by using winform application in Microsof.docxjbarbara1
 
1- Consulting a periodic table- Which of the six cations studied are f.docx
1- Consulting a periodic table- Which of the six cations studied are f.docx1- Consulting a periodic table- Which of the six cations studied are f.docx
1- Consulting a periodic table- Which of the six cations studied are f.docxjbarbara1
 
1- Briefly state the difference between single stage and multistage di.docx
1- Briefly state the difference between single stage and multistage di.docx1- Briefly state the difference between single stage and multistage di.docx
1- Briefly state the difference between single stage and multistage di.docxjbarbara1
 
1- A polar section of a molecule- which is---Select--- to water- is ca.docx
1- A polar section of a molecule- which is---Select--- to water- is ca.docx1- A polar section of a molecule- which is---Select--- to water- is ca.docx
1- A polar section of a molecule- which is---Select--- to water- is ca.docxjbarbara1
 
1) Is technology the critical driver of globalization- 2) What is the.docx
1) Is technology the critical driver of globalization- 2) What is the.docx1) Is technology the critical driver of globalization- 2) What is the.docx
1) Is technology the critical driver of globalization- 2) What is the.docxjbarbara1
 
1) What creates the US federal government-wide financial statements- 2.docx
1) What creates the US federal government-wide financial statements- 2.docx1) What creates the US federal government-wide financial statements- 2.docx
1) What creates the US federal government-wide financial statements- 2.docxjbarbara1
 
1) describe how temperature influenced what materials condensed from t.docx
1) describe how temperature influenced what materials condensed from t.docx1) describe how temperature influenced what materials condensed from t.docx
1) describe how temperature influenced what materials condensed from t.docxjbarbara1
 
1- People- places- things- ideas and forces are what part of speech- V.docx
1- People- places- things- ideas and forces are what part of speech- V.docx1- People- places- things- ideas and forces are what part of speech- V.docx
1- People- places- things- ideas and forces are what part of speech- V.docxjbarbara1
 
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docxjbarbara1
 
1- How are budgets used for a company or in government- What would you.docx
1- How are budgets used for a company or in government- What would you.docx1- How are budgets used for a company or in government- What would you.docx
1- How are budgets used for a company or in government- What would you.docxjbarbara1
 
1- How are temperature and heat different concepts- 2- How does the sp.docx
1- How are temperature and heat different concepts- 2- How does the sp.docx1- How are temperature and heat different concepts- 2- How does the sp.docx
1- How are temperature and heat different concepts- 2- How does the sp.docxjbarbara1
 
1- According to the career opportunities on their websites- what are s.docx
1- According to the career opportunities on their websites- what are s.docx1- According to the career opportunities on their websites- what are s.docx
1- According to the career opportunities on their websites- what are s.docxjbarbara1
 
Which is the stronger acid in the following pair- Explain your reasoni.docx
Which is the stronger acid in the following pair- Explain your reasoni.docxWhich is the stronger acid in the following pair- Explain your reasoni.docx
Which is the stronger acid in the following pair- Explain your reasoni.docxjbarbara1
 
Which is NOT true for solute retention- A) Retention time- tr- is the.docx
Which is NOT true for solute retention- A) Retention time- tr- is the.docxWhich is NOT true for solute retention- A) Retention time- tr- is the.docx
Which is NOT true for solute retention- A) Retention time- tr- is the.docxjbarbara1
 
Which form type displays records in a tabular format similar to a Data.docx
Which form type displays records in a tabular format similar to a Data.docxWhich form type displays records in a tabular format similar to a Data.docx
Which form type displays records in a tabular format similar to a Data.docxjbarbara1
 
which equation best represents the net ionic reaction that occurs when.docx
which equation best represents the net ionic reaction that occurs when.docxwhich equation best represents the net ionic reaction that occurs when.docx
which equation best represents the net ionic reaction that occurs when.docxjbarbara1
 
Which complex in the electron transport chain does not contribute to t.docx
Which complex in the electron transport chain does not contribute to t.docxWhich complex in the electron transport chain does not contribute to t.docx
Which complex in the electron transport chain does not contribute to t.docxjbarbara1
 
where heat is transfer high in conduction or convection where heat i.docx
where heat is transfer high in conduction or convection   where heat i.docxwhere heat is transfer high in conduction or convection   where heat i.docx
where heat is transfer high in conduction or convection where heat i.docxjbarbara1
 
Where do most college students exist on Maslow-'s hierarchy of needs-.docx
Where do most college students exist on Maslow-'s hierarchy of needs-.docxWhere do most college students exist on Maslow-'s hierarchy of needs-.docx
Where do most college students exist on Maslow-'s hierarchy of needs-.docxjbarbara1
 

Mehr von jbarbara1 (20)

1- Define computer crime and list several examples of computer crime-.docx
1- Define computer crime and list several examples of computer crime-.docx1- Define computer crime and list several examples of computer crime-.docx
1- Define computer crime and list several examples of computer crime-.docx
 
1- Create a Visual Calculator by using winform application in Microsof.docx
1- Create a Visual Calculator by using winform application in Microsof.docx1- Create a Visual Calculator by using winform application in Microsof.docx
1- Create a Visual Calculator by using winform application in Microsof.docx
 
1- Consulting a periodic table- Which of the six cations studied are f.docx
1- Consulting a periodic table- Which of the six cations studied are f.docx1- Consulting a periodic table- Which of the six cations studied are f.docx
1- Consulting a periodic table- Which of the six cations studied are f.docx
 
1- Briefly state the difference between single stage and multistage di.docx
1- Briefly state the difference between single stage and multistage di.docx1- Briefly state the difference between single stage and multistage di.docx
1- Briefly state the difference between single stage and multistage di.docx
 
1- A polar section of a molecule- which is---Select--- to water- is ca.docx
1- A polar section of a molecule- which is---Select--- to water- is ca.docx1- A polar section of a molecule- which is---Select--- to water- is ca.docx
1- A polar section of a molecule- which is---Select--- to water- is ca.docx
 
1) Is technology the critical driver of globalization- 2) What is the.docx
1) Is technology the critical driver of globalization- 2) What is the.docx1) Is technology the critical driver of globalization- 2) What is the.docx
1) Is technology the critical driver of globalization- 2) What is the.docx
 
1) What creates the US federal government-wide financial statements- 2.docx
1) What creates the US federal government-wide financial statements- 2.docx1) What creates the US federal government-wide financial statements- 2.docx
1) What creates the US federal government-wide financial statements- 2.docx
 
1) describe how temperature influenced what materials condensed from t.docx
1) describe how temperature influenced what materials condensed from t.docx1) describe how temperature influenced what materials condensed from t.docx
1) describe how temperature influenced what materials condensed from t.docx
 
1- People- places- things- ideas and forces are what part of speech- V.docx
1- People- places- things- ideas and forces are what part of speech- V.docx1- People- places- things- ideas and forces are what part of speech- V.docx
1- People- places- things- ideas and forces are what part of speech- V.docx
 
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx
1- In the context of DNS (a) What are the Resource Records- RR- (b) Wh.docx
 
1- How are budgets used for a company or in government- What would you.docx
1- How are budgets used for a company or in government- What would you.docx1- How are budgets used for a company or in government- What would you.docx
1- How are budgets used for a company or in government- What would you.docx
 
1- How are temperature and heat different concepts- 2- How does the sp.docx
1- How are temperature and heat different concepts- 2- How does the sp.docx1- How are temperature and heat different concepts- 2- How does the sp.docx
1- How are temperature and heat different concepts- 2- How does the sp.docx
 
1- According to the career opportunities on their websites- what are s.docx
1- According to the career opportunities on their websites- what are s.docx1- According to the career opportunities on their websites- what are s.docx
1- According to the career opportunities on their websites- what are s.docx
 
Which is the stronger acid in the following pair- Explain your reasoni.docx
Which is the stronger acid in the following pair- Explain your reasoni.docxWhich is the stronger acid in the following pair- Explain your reasoni.docx
Which is the stronger acid in the following pair- Explain your reasoni.docx
 
Which is NOT true for solute retention- A) Retention time- tr- is the.docx
Which is NOT true for solute retention- A) Retention time- tr- is the.docxWhich is NOT true for solute retention- A) Retention time- tr- is the.docx
Which is NOT true for solute retention- A) Retention time- tr- is the.docx
 
Which form type displays records in a tabular format similar to a Data.docx
Which form type displays records in a tabular format similar to a Data.docxWhich form type displays records in a tabular format similar to a Data.docx
Which form type displays records in a tabular format similar to a Data.docx
 
which equation best represents the net ionic reaction that occurs when.docx
which equation best represents the net ionic reaction that occurs when.docxwhich equation best represents the net ionic reaction that occurs when.docx
which equation best represents the net ionic reaction that occurs when.docx
 
Which complex in the electron transport chain does not contribute to t.docx
Which complex in the electron transport chain does not contribute to t.docxWhich complex in the electron transport chain does not contribute to t.docx
Which complex in the electron transport chain does not contribute to t.docx
 
where heat is transfer high in conduction or convection where heat i.docx
where heat is transfer high in conduction or convection   where heat i.docxwhere heat is transfer high in conduction or convection   where heat i.docx
where heat is transfer high in conduction or convection where heat i.docx
 
Where do most college students exist on Maslow-'s hierarchy of needs-.docx
Where do most college students exist on Maslow-'s hierarchy of needs-.docxWhere do most college students exist on Maslow-'s hierarchy of needs-.docx
Where do most college students exist on Maslow-'s hierarchy of needs-.docx
 

Kürzlich hochgeladen

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

1- develop a C program to print the sum- the average- the product- the.docx

  • 1. 1. develop a C program to print the sum, the average, the product, the largest and the smallest of 3 integers that are input from the keyboard. 2. define an array x of size 5, using call-by-reference (that is, use pointer) to pass the array to a function, named summation. In main: define array, print out the array, pass the array and show the results on screen. In function summation: take arrays from main and sum the arrays using the formula below sum=4summation0 xi*xi Solution #include <stdio.h> #include<conio.h> void summation(int a[],int size) { int i; int sum = 0; for(i=0;i<size;i++) { sum = sum+ 4*a[i]*a[i]; } printf(" Summation is %d",sum); } int main(void) { // your code goes here int a,size; int b[] = {1,2,3}; int i =0,max = 0,min =0 ,sum = 0 ,product = 1,average = 0 ;
  • 2. for(i=0;i<3;i++) { printf("Enter the value of %d number",i+1); scanf("%d",&a); if(i==0) min = a; sum =sum+a; product = product*a; if(a>=max) max = a; if(a<=min) min = a; } average = sum/3; printf("Sum is %d Product is %d average is %d max is %d min is %d ",sum,product,average,max,min); size = sizeof(b)/sizeof(b[1]); printf("Array Content "); for(i=0;i<size;i++) { printf ("%d ",b[i]); } summation(b,size); getch(); return 0; }