Find largest digit in c program

107 words · Published 01 Jan 2015

Student-written example · Data Analysis

Shared for study and reference. Not a sample of our professional writing.

About this example

This essay was contributed by a student. The views expressed are the author’s and do not necessarily reflect those of UKEssays. Use it to inform your reading and develop your own work.

mumbers (positive,nagative,integer,double numbers) from the keyboard and prints area,largest number,negcount,reverse,average.*/

//including header file

#include

using namespace std;

// main declaration

void main()

{

//declaring variables

int num;

int sum1=0;

float sum2=0;

int negcount=0;

int i=0;

int largest;

int smallest;

float average=0.0;

int temp1=0;

int temp2=0;

float area=0.0;

int radius;

int large;

int small;

int temp3;

int b;

int temp4;

int temp;

int poscount=0;

float pi=3.14;

for(i=0; i<8; i++)

{

//Reading numbers from user

cout << "Enter integer number " << i+1 << ", followed by 'Enter': ", i;

cin >> num;

if(i==0)

{

largest=num;

smallest=num;

temp=num;

}

if(i==1)

temp3=num;

if( num > 0 )//Considering positive numbers

{

if(poscount==0)

{

large=num;

small=num;

}

sum1= sum1+num;

poscount++;

}

else

{

// considering negative numbers

if(negcount==0)

temp1=num;

if(negcount==1)

temp2=num;

if(temp2<0)

sum2=temp1+temp2;

average = sum2/2;

negcount++;

}

// checking the largest number of given 8 numbers

if ( num < smallest )

{

smallest = num;

}

if ( num > largest )

{

largest = num;

}

//checking the smallest positive number

if(num>0)

{

if ( num <= small )

{

Find largest digit in c program small = num;

}

if ( num >= large )

{

large = num;

}

radius=small;

area=pi*(radius*radius);//calculating the area of the circle

}

// reversing the first two numbers entred

b=temp-((temp/10)*10);

temp4=b;

}

//printing outputs for given inputs

cout<

cout << "Sum of positive numbers entered is " << sum1 << endl;

cout << "count of negative numbers entered is " << negcount << endl;

cout << "Largest number of all entered inputs is " << largest<

cout<<"reverse of first two numbers is"<

cout<< temp4<

cout<<"average of first two negative numbers given is"<

cout<<"area of circle using small positive number as radius"<

}

UKEssays writing support

Need support with your own question?

Our experienced academic writers hold at least a 2:1 degree from a reputable university, with most exceeding this minimum.

Send us your question and, if you wish, any marking criteria. We’ll write a model answer to your brief.

UK Essays

UK Essays

Established in 2003 by qualified barrister Barclay Littlewood, UK Essays is a leading provider of expert educational support. Our dedicated in-house team of academically qualified specialists works alongside over 500 UK-qualified researchers to deliver exceptional bespoke essay writing services across a wide range of subjects and levels. With extensive press coverage and more than 1,800 verified reviews, we’re the UK’s #1 choice for academic excellence.

Areas of Expertise

Academic Writing Assignment Help Essay Writing Dissertation Writing Coursework Support Report Writing Literature Reviews Reflective Writing Case Studies Nursing Assignments Law Assignments Research Proposals Exam Revision Proofreading Editing Presentation Development Group Projects Portfolio Preparation Study Guidance

Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please click the following link to email our support team:

Request essay removal

Related Services

Our academic writing and marking services can help you!

Prices from

£99

Approximate costs for:

  • Undergraduate 2:2
  • 1000 words
  • 7 day delivery

Order an Essay

Related Lectures

Study for free with our range of university lecture notes!

Academic Knowledge Logo

Freelance Writing Jobs

Looking for a flexible role?
Do you have a 2:1 degree or higher?

Apply Today!