SlideShare a Scribd company logo
1 of 6
Download to read offline
#include
#include
#include
double total(int array[], int n)
{
int i, sum =0;
for (i = 0; i < n; i++)
{
sum = sum + array[i];
}
return sum;
}
int main()
{
srand(time(NULL));
int i, n, rand_number;
printf("Enter an integer: ");
scanf("%d",&n);
int array[n];
for (i = 0; i < n; i++)
{
rand_number = rand() % 1000;
array[i] = rand_number;
}
int max = array[0];
int min = array[0];
int min_pos;
int max_pos;
for (i = 0; i < n; i++)
{
if(array[i] > max)
{
max = array[i];
max_pos = i;
}
if(array[i] < min)
{
min = array[i];
min_pos = i;
}
}
int sum = total(array,n);
double average = sum/n;
printf("min: %d pos: %d ",min, min_pos);
printf("max: %d pos: %d ",max, max_pos);
printf("sum: %d  ",sum);
printf("average: %lf  ",average);
printf("Post|tval ");
printf("----------------------- ");
for (i = 0; i < n; ++i)
{
printf("%dt|t%d ",i,array[i]);
}
printf(" ");
return 0;
}
/*
output:
Enter an integer: 30
min: 5 pos: 28
max: 998 pos: 0
sum: 14093
average: 469.000000
Pos | val
-----------------------
0 | 998
1 | 403
2 | 523
3 | 787
4 | 37
5 | 14
6 | 815
7 | 232
8 | 594
9 | 555
10 | 531
11 | 52
12 | 550
13 | 530
14 | 265
15 | 839
16 | 247
17 | 902
18 | 99
19 | 120
20 | 648
21 | 101
22 | 6
23 | 983
24 | 759
25 | 664
26 | 371
27 | 705
28 | 5
29 | 758
*/
Solution
#include
#include
#include
double total(int array[], int n)
{
int i, sum =0;
for (i = 0; i < n; i++)
{
sum = sum + array[i];
}
return sum;
}
int main()
{
srand(time(NULL));
int i, n, rand_number;
printf("Enter an integer: ");
scanf("%d",&n);
int array[n];
for (i = 0; i < n; i++)
{
rand_number = rand() % 1000;
array[i] = rand_number;
}
int max = array[0];
int min = array[0];
int min_pos;
int max_pos;
for (i = 0; i < n; i++)
{
if(array[i] > max)
{
max = array[i];
max_pos = i;
}
if(array[i] < min)
{
min = array[i];
min_pos = i;
}
}
int sum = total(array,n);
double average = sum/n;
printf("min: %d pos: %d ",min, min_pos);
printf("max: %d pos: %d ",max, max_pos);
printf("sum: %d  ",sum);
printf("average: %lf  ",average);
printf("Post|tval ");
printf("----------------------- ");
for (i = 0; i < n; ++i)
{
printf("%dt|t%d ",i,array[i]);
}
printf(" ");
return 0;
}
/*
output:
Enter an integer: 30
min: 5 pos: 28
max: 998 pos: 0
sum: 14093
average: 469.000000
Pos | val
-----------------------
0 | 998
1 | 403
2 | 523
3 | 787
4 | 37
5 | 14
6 | 815
7 | 232
8 | 594
9 | 555
10 | 531
11 | 52
12 | 550
13 | 530
14 | 265
15 | 839
16 | 247
17 | 902
18 | 99
19 | 120
20 | 648
21 | 101
22 | 6
23 | 983
24 | 759
25 | 664
26 | 371
27 | 705
28 | 5
29 | 758
*/

More Related Content

Similar to #include stdio.h #include stdlib.h #include time.hdouble.pdf

Data Structure using C
Data Structure using CData Structure using C
Data Structure using CBilal Mirza
 
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
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresLakshmi Sarvani Videla
 
Sorting programs
Sorting programsSorting programs
Sorting programsVarun Garg
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...DR B.Surendiran .
 
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdfapleather
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxscroghamtressie
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shortingargusacademy
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdfanujmkt
 

Similar to #include stdio.h #include stdlib.h #include time.hdouble.pdf (20)

InsertionSort.pdf
InsertionSort.pdfInsertionSort.pdf
InsertionSort.pdf
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
array.ppt
array.pptarray.ppt
array.ppt
 
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
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Sorting programs
Sorting programsSorting programs
Sorting programs
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
1D Array
1D Array1D Array
1D Array
 
Ada file
Ada fileAda file
Ada file
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
 
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
Arrays
ArraysArrays
Arrays
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
 

More from arjunchetri1

The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdf
The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdfThe products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdf
The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdfarjunchetri1
 
SolutionDividend per share= total dividend paid out to common stoc.pdf
SolutionDividend per share= total dividend paid out to common stoc.pdfSolutionDividend per share= total dividend paid out to common stoc.pdf
SolutionDividend per share= total dividend paid out to common stoc.pdfarjunchetri1
 
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdf
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdfPure risk is a case where the outcome is strictly defined i.e. eithe.pdf
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdfarjunchetri1
 
Pauliss rule Electrons fill orbitals having lowest energy states.pdf
Pauliss rule  Electrons fill orbitals having lowest energy states.pdfPauliss rule  Electrons fill orbitals having lowest energy states.pdf
Pauliss rule Electrons fill orbitals having lowest energy states.pdfarjunchetri1
 
Polymearase Chain Reaction and Electrophoresis can used employed in .pdf
Polymearase Chain Reaction and Electrophoresis can used employed in .pdfPolymearase Chain Reaction and Electrophoresis can used employed in .pdf
Polymearase Chain Reaction and Electrophoresis can used employed in .pdfarjunchetri1
 
P& loss ac drTo provision for social securituy taxes (amount of g.pdf
P& loss ac drTo provision for social securituy taxes (amount of g.pdfP& loss ac drTo provision for social securituy taxes (amount of g.pdf
P& loss ac drTo provision for social securituy taxes (amount of g.pdfarjunchetri1
 
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdf
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdfOne month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdf
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdfarjunchetri1
 
Nothing happens.SolutionNothing happens..pdf
Nothing happens.SolutionNothing happens..pdfNothing happens.SolutionNothing happens..pdf
Nothing happens.SolutionNothing happens..pdfarjunchetri1
 
Intranet Portals1) Intranet portals now a days are at the epicent.pdf
Intranet Portals1) Intranet portals now a days are at the epicent.pdfIntranet Portals1) Intranet portals now a days are at the epicent.pdf
Intranet Portals1) Intranet portals now a days are at the epicent.pdfarjunchetri1
 
import java.awt.; Using AWT container and component classes im.pdf
import java.awt.;  Using AWT container and component classes im.pdfimport java.awt.;  Using AWT container and component classes im.pdf
import java.awt.; Using AWT container and component classes im.pdfarjunchetri1
 
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdf
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdfIf possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdf
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdfarjunchetri1
 
How should the judicial system treat juvenile criminal offendersJ.pdf
How should the judicial system treat juvenile criminal offendersJ.pdfHow should the judicial system treat juvenile criminal offendersJ.pdf
How should the judicial system treat juvenile criminal offendersJ.pdfarjunchetri1
 
coordinated movements of gastrulation begin. This dramatic process t.pdf
coordinated movements of gastrulation begin. This dramatic process t.pdfcoordinated movements of gastrulation begin. This dramatic process t.pdf
coordinated movements of gastrulation begin. This dramatic process t.pdfarjunchetri1
 
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdf
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdfCu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdf
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdfarjunchetri1
 
Assign a major brain structure to each of the cehalon belowdiencep.pdf
Assign a major brain structure to each of the cehalon belowdiencep.pdfAssign a major brain structure to each of the cehalon belowdiencep.pdf
Assign a major brain structure to each of the cehalon belowdiencep.pdfarjunchetri1
 
B. Assets are listed in descending order of liquidity.The most liq.pdf
B. Assets are listed in descending order of liquidity.The most liq.pdfB. Assets are listed in descending order of liquidity.The most liq.pdf
B. Assets are listed in descending order of liquidity.The most liq.pdfarjunchetri1
 
ans) 2 is the true oneone parentheses one thied close parentheses .pdf
ans) 2 is the true oneone parentheses one thied close parentheses .pdfans) 2 is the true oneone parentheses one thied close parentheses .pdf
ans) 2 is the true oneone parentheses one thied close parentheses .pdfarjunchetri1
 
Answer B. FiberExplanationFiber optic cable is used by the Int.pdf
Answer B. FiberExplanationFiber optic cable is used by the Int.pdfAnswer B. FiberExplanationFiber optic cable is used by the Int.pdf
Answer B. FiberExplanationFiber optic cable is used by the Int.pdfarjunchetri1
 
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdf
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdfAnswer The outer earPinnaEar canalThe Middle EarTympanic .pdf
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdfarjunchetri1
 
the carbon 2 and carbon 3 are having one double b.pdf
                     the carbon 2 and carbon 3 are having one double b.pdf                     the carbon 2 and carbon 3 are having one double b.pdf
the carbon 2 and carbon 3 are having one double b.pdfarjunchetri1
 

More from arjunchetri1 (20)

The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdf
The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdfThe products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdf
The products are K2SO4(aq), H2O(l)KOH(aq) + H2SO4(aq) = K2SO4(aq.pdf
 
SolutionDividend per share= total dividend paid out to common stoc.pdf
SolutionDividend per share= total dividend paid out to common stoc.pdfSolutionDividend per share= total dividend paid out to common stoc.pdf
SolutionDividend per share= total dividend paid out to common stoc.pdf
 
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdf
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdfPure risk is a case where the outcome is strictly defined i.e. eithe.pdf
Pure risk is a case where the outcome is strictly defined i.e. eithe.pdf
 
Pauliss rule Electrons fill orbitals having lowest energy states.pdf
Pauliss rule  Electrons fill orbitals having lowest energy states.pdfPauliss rule  Electrons fill orbitals having lowest energy states.pdf
Pauliss rule Electrons fill orbitals having lowest energy states.pdf
 
Polymearase Chain Reaction and Electrophoresis can used employed in .pdf
Polymearase Chain Reaction and Electrophoresis can used employed in .pdfPolymearase Chain Reaction and Electrophoresis can used employed in .pdf
Polymearase Chain Reaction and Electrophoresis can used employed in .pdf
 
P& loss ac drTo provision for social securituy taxes (amount of g.pdf
P& loss ac drTo provision for social securituy taxes (amount of g.pdfP& loss ac drTo provision for social securituy taxes (amount of g.pdf
P& loss ac drTo provision for social securituy taxes (amount of g.pdf
 
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdf
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdfOne month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdf
One month liquidity index=10(.981)+90(.85.92)=0.93Liquidity .pdf
 
Nothing happens.SolutionNothing happens..pdf
Nothing happens.SolutionNothing happens..pdfNothing happens.SolutionNothing happens..pdf
Nothing happens.SolutionNothing happens..pdf
 
Intranet Portals1) Intranet portals now a days are at the epicent.pdf
Intranet Portals1) Intranet portals now a days are at the epicent.pdfIntranet Portals1) Intranet portals now a days are at the epicent.pdf
Intranet Portals1) Intranet portals now a days are at the epicent.pdf
 
import java.awt.; Using AWT container and component classes im.pdf
import java.awt.;  Using AWT container and component classes im.pdfimport java.awt.;  Using AWT container and component classes im.pdf
import java.awt.; Using AWT container and component classes im.pdf
 
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdf
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdfIf possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdf
If possible let T+e1+e2+e2 be non planarThen either one of e1, e2 .pdf
 
How should the judicial system treat juvenile criminal offendersJ.pdf
How should the judicial system treat juvenile criminal offendersJ.pdfHow should the judicial system treat juvenile criminal offendersJ.pdf
How should the judicial system treat juvenile criminal offendersJ.pdf
 
coordinated movements of gastrulation begin. This dramatic process t.pdf
coordinated movements of gastrulation begin. This dramatic process t.pdfcoordinated movements of gastrulation begin. This dramatic process t.pdf
coordinated movements of gastrulation begin. This dramatic process t.pdf
 
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdf
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdfCu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdf
Cu(II)Oxide has solid with mono clinic structure .m.p is 12010 C and.pdf
 
Assign a major brain structure to each of the cehalon belowdiencep.pdf
Assign a major brain structure to each of the cehalon belowdiencep.pdfAssign a major brain structure to each of the cehalon belowdiencep.pdf
Assign a major brain structure to each of the cehalon belowdiencep.pdf
 
B. Assets are listed in descending order of liquidity.The most liq.pdf
B. Assets are listed in descending order of liquidity.The most liq.pdfB. Assets are listed in descending order of liquidity.The most liq.pdf
B. Assets are listed in descending order of liquidity.The most liq.pdf
 
ans) 2 is the true oneone parentheses one thied close parentheses .pdf
ans) 2 is the true oneone parentheses one thied close parentheses .pdfans) 2 is the true oneone parentheses one thied close parentheses .pdf
ans) 2 is the true oneone parentheses one thied close parentheses .pdf
 
Answer B. FiberExplanationFiber optic cable is used by the Int.pdf
Answer B. FiberExplanationFiber optic cable is used by the Int.pdfAnswer B. FiberExplanationFiber optic cable is used by the Int.pdf
Answer B. FiberExplanationFiber optic cable is used by the Int.pdf
 
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdf
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdfAnswer The outer earPinnaEar canalThe Middle EarTympanic .pdf
Answer The outer earPinnaEar canalThe Middle EarTympanic .pdf
 
the carbon 2 and carbon 3 are having one double b.pdf
                     the carbon 2 and carbon 3 are having one double b.pdf                     the carbon 2 and carbon 3 are having one double b.pdf
the carbon 2 and carbon 3 are having one double b.pdf
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
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
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
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
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

#include stdio.h #include stdlib.h #include time.hdouble.pdf

  • 1. #include #include #include double total(int array[], int n) { int i, sum =0; for (i = 0; i < n; i++) { sum = sum + array[i]; } return sum; } int main() { srand(time(NULL)); int i, n, rand_number; printf("Enter an integer: "); scanf("%d",&n); int array[n]; for (i = 0; i < n; i++) { rand_number = rand() % 1000; array[i] = rand_number; } int max = array[0]; int min = array[0]; int min_pos; int max_pos; for (i = 0; i < n; i++) { if(array[i] > max) {
  • 2. max = array[i]; max_pos = i; } if(array[i] < min) { min = array[i]; min_pos = i; } } int sum = total(array,n); double average = sum/n; printf("min: %d pos: %d ",min, min_pos); printf("max: %d pos: %d ",max, max_pos); printf("sum: %d ",sum); printf("average: %lf ",average); printf("Post|tval "); printf("----------------------- "); for (i = 0; i < n; ++i) { printf("%dt|t%d ",i,array[i]); } printf(" "); return 0; } /* output: Enter an integer: 30 min: 5 pos: 28 max: 998 pos: 0 sum: 14093 average: 469.000000 Pos | val ----------------------- 0 | 998
  • 3. 1 | 403 2 | 523 3 | 787 4 | 37 5 | 14 6 | 815 7 | 232 8 | 594 9 | 555 10 | 531 11 | 52 12 | 550 13 | 530 14 | 265 15 | 839 16 | 247 17 | 902 18 | 99 19 | 120 20 | 648 21 | 101 22 | 6 23 | 983 24 | 759 25 | 664 26 | 371 27 | 705 28 | 5 29 | 758 */ Solution #include #include #include
  • 4. double total(int array[], int n) { int i, sum =0; for (i = 0; i < n; i++) { sum = sum + array[i]; } return sum; } int main() { srand(time(NULL)); int i, n, rand_number; printf("Enter an integer: "); scanf("%d",&n); int array[n]; for (i = 0; i < n; i++) { rand_number = rand() % 1000; array[i] = rand_number; } int max = array[0]; int min = array[0]; int min_pos; int max_pos; for (i = 0; i < n; i++) { if(array[i] > max) { max = array[i]; max_pos = i; } if(array[i] < min)
  • 5. { min = array[i]; min_pos = i; } } int sum = total(array,n); double average = sum/n; printf("min: %d pos: %d ",min, min_pos); printf("max: %d pos: %d ",max, max_pos); printf("sum: %d ",sum); printf("average: %lf ",average); printf("Post|tval "); printf("----------------------- "); for (i = 0; i < n; ++i) { printf("%dt|t%d ",i,array[i]); } printf(" "); return 0; } /* output: Enter an integer: 30 min: 5 pos: 28 max: 998 pos: 0 sum: 14093 average: 469.000000 Pos | val ----------------------- 0 | 998 1 | 403 2 | 523 3 | 787 4 | 37
  • 6. 5 | 14 6 | 815 7 | 232 8 | 594 9 | 555 10 | 531 11 | 52 12 | 550 13 | 530 14 | 265 15 | 839 16 | 247 17 | 902 18 | 99 19 | 120 20 | 648 21 | 101 22 | 6 23 | 983 24 | 759 25 | 664 26 | 371 27 | 705 28 | 5 29 | 758 */