### Find largest digit in c program

23 Mar 2015

Disclaimer:
This essay has been written and submitted by students and is not an example of our work. Please click this link to view samples of our professional work witten by our professional essay writers. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of EssayCompany.

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

#include <iostream>

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 large;

int small;

int temp3;

int b;

int temp4;

int temp;

int poscount=0;

float pi=3.14;

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

{

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;

}

}

// reversing the first two numbers entred

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

temp4=b;

}

//printing outputs for given inputs

cout<<endl;

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<<endl;

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

cout<< temp4<<endl;

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

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

}

### Request Removal

If you are the real writer of this essay and no longer want to have the essay published on the our website then please click on the link below to send us request removal:

Get in Touch With us

Get in touch with our dedicated team to discuss about your requirements in detail. We are here to help you our best in any way. If you are unsure about what you exactly need, please complete the short enquiry form below and we will get back to you with quote as soon as possible.