SlideShare a Scribd company logo
Write a program that reads in integer as many as the user enters from standard input and print out
the Maximum and minimum values.
Solution
Answer
#include<stdio.h>
#include<conio.h>
//------main function-----//
main()
{
//------Variable Declaration--------//
int a[10],i,n,max,min;
//-----Enter the input value using printf() and scanf() function------//
printf("Enter the Value of N:");
scanf("%d",&n);
printf(" ");
//----Input N Element using For Loop----//
for(i=0;i<n;i++)
{
printf("Enter the %d Element",i+1);
scanf("%d",&a[i]);
}
min=a[0]; //----Minimum Number Initialization-----//
max=a[0]; //----Maximum Number Initialization-----//
//----Minimum and Maximum Number Calculation using For Loop-----//
for(i=0;i<n;i++)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
//---------- Dispaly Result-------//
printf(" The Maximum Number is %d ",max);
printf("the Minimum Number is %d ",min);
getch(); //---Function for Hold Output Screen--//
return 0;
}
Write a program that reads in integer as many as the user enters from.docx

More Related Content

PDF
Data Structure using C
DOCX
SaraPIC
PPTX
Basic c++ programs
PDF
6. functions
PDF
C Programming lab
DOC
C important questions
DOCX
Practical File of C Language
Data Structure using C
SaraPIC
Basic c++ programs
6. functions
C Programming lab
C important questions
Practical File of C Language

Similar to Write a program that reads in integer as many as the user enters from.docx (20)

DOCX
Muzzammilrashid
PDF
Common problems solving using c
PPT
ch6_additional.ppt
PPTX
Lab-11-C-Problems.pptx
PPT
array.ppt
PDF
10 template code program
DOCX
Let us C (by yashvant Kanetkar) chapter 3 Solution
PDF
C lab programs
PDF
C lab programs
DOCX
Programming fundamentals
PPTX
Basics of C programming - day 2
PDF
Simple C programs
PDF
C- Programming Assignment practice set 2 solutions
PDF
GE23121_C programming Laboratory Record.pdf
PDF
Computer_Practicals-file.doc.pdf
DOCX
C lab manaual
PPTX
Introduction to Basic C programming 02
PDF
Develop a system flowchart and then write a menu-driven C++ program .pdf
Muzzammilrashid
Common problems solving using c
ch6_additional.ppt
Lab-11-C-Problems.pptx
array.ppt
10 template code program
Let us C (by yashvant Kanetkar) chapter 3 Solution
C lab programs
C lab programs
Programming fundamentals
Basics of C programming - day 2
Simple C programs
C- Programming Assignment practice set 2 solutions
GE23121_C programming Laboratory Record.pdf
Computer_Practicals-file.doc.pdf
C lab manaual
Introduction to Basic C programming 02
Develop a system flowchart and then write a menu-driven C++ program .pdf
Ad

More from lez31palka (20)

DOCX
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
DOCX
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
DOCX
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
DOCX
Critical Reflection 2 is a reflective essay that connects a personal e.docx
DOCX
Credit rating agencies help investor to determine- A- If stock worth t.docx
DOCX
Create software that can encrypt and decrypt using a general substitut.docx
DOCX
create a training to give to others on a skillset you are an expert on.docx
DOCX
Create a tic tac toe game using Swift and taking input text input- You.docx
DOCX
Create a shell script file called q4-sh.docx
DOCX
Create a python zork file based on the following UML- Use command func.docx
DOCX
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
DOCX
Create a new webpage called -activity2-html-- This new page must inclu.docx
DOCX
Create a multi-client-single server application to check whether the n.docx
DOCX
Create a list containing decimal numbers- Write a program to find the.docx
DOCX
Create a JAVA class called Staff that has the following attributes- St.docx
DOCX
Create a Java class with the below attributes- Create a class called.docx
DOCX
Create a JAVA class called Faculty that has the following attributes-.docx
DOCX
Create a garden project - Submit a project scope document - Submit R.docx
DOCX
Create a file named insert-php and add the new records in to your rese.docx
DOCX
Corporate Fund started the year with o net asset value of $30-80- By y.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docx
Credit rating agencies help investor to determine- A- If stock worth t.docx
Create software that can encrypt and decrypt using a general substitut.docx
create a training to give to others on a skillset you are an expert on.docx
Create a tic tac toe game using Swift and taking input text input- You.docx
Create a shell script file called q4-sh.docx
Create a python zork file based on the following UML- Use command func.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new webpage called -activity2-html-- This new page must inclu.docx
Create a multi-client-single server application to check whether the n.docx
Create a list containing decimal numbers- Write a program to find the.docx
Create a JAVA class called Staff that has the following attributes- St.docx
Create a Java class with the below attributes- Create a class called.docx
Create a JAVA class called Faculty that has the following attributes-.docx
Create a garden project - Submit a project scope document - Submit R.docx
Create a file named insert-php and add the new records in to your rese.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docx
Ad

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Structure & Organelles in detailed.
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Classroom Observation Tools for Teachers
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
RMMM.pdf make it easy to upload and study
PPTX
Cell Types and Its function , kingdom of life
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Final Presentation General Medicine 03-08-2024.pptx
Insiders guide to clinical Medicine.pdf
Supply Chain Operations Speaking Notes -ICLT Program
PPH.pptx obstetrics and gynecology in nursing
VCE English Exam - Section C Student Revision Booklet
Pharma ospi slides which help in ospi learning
Microbial diseases, their pathogenesis and prophylaxis
Cell Structure & Organelles in detailed.
O7-L3 Supply Chain Operations - ICLT Program
Classroom Observation Tools for Teachers
Anesthesia in Laparoscopic Surgery in India
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
RMMM.pdf make it easy to upload and study
Cell Types and Its function , kingdom of life
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF

Write a program that reads in integer as many as the user enters from.docx

  • 1. Write a program that reads in integer as many as the user enters from standard input and print out the Maximum and minimum values. Solution Answer #include<stdio.h> #include<conio.h> //------main function-----// main() { //------Variable Declaration--------// int a[10],i,n,max,min; //-----Enter the input value using printf() and scanf() function------// printf("Enter the Value of N:"); scanf("%d",&n); printf(" "); //----Input N Element using For Loop----// for(i=0;i<n;i++) { printf("Enter the %d Element",i+1);
  • 2. scanf("%d",&a[i]); } min=a[0]; //----Minimum Number Initialization-----// max=a[0]; //----Maximum Number Initialization-----// //----Minimum and Maximum Number Calculation using For Loop-----// for(i=0;i<n;i++) { if(a[i]>max) max=a[i]; if(a[i]<min) min=a[i]; } //---------- Dispaly Result-------// printf(" The Maximum Number is %d ",max); printf("the Minimum Number is %d ",min); getch(); //---Function for Hold Output Screen--// return 0; }