===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int i,EVEN=0,ODD=0,Total=0,Positive=0,Negative=0,L,S,q=1;
gotoxy(32,2);
cprintf("Program to find:-");
gotoxy(32,4);
cprintf(" Largest number");
gotoxy(32,5);
cprintf(" Smallest number");
gotoxy(32,6);
cprintf(" Sum of Odd and Even number");
gotoxy(32,7);
cprintf(" Sum of +ve and -ve number");
gotoxy(32,9);
cprintf("* To stop program Enter \"0\"");
gotoxy(10,10);
while(i!=0)
{
cout<<"\nEnter "<<q<<" number: ";
cin>>i;
if(q==1)
{
L=i;
S=i;
}
else
{
if(L<=i)
L=i;
else if(L>i)
L=L;
if(S>i)
S=i;
else if(S<=i)
S=S;
}
if(i%2==0)
EVEN=i+EVEN;
else
ODD=i+ODD;
Total=Total+i;
if(i<0)
Negative=Negative+i;
else if(i>0)
Positive=Positive+i;
q++;
}
cout<<"\n\n ¯The Largest number is: "<<L;
cout<<"\n\n ¯The Smallest number is: "<<S;
cout<<"\n\n ¯The Total sum is: "<<Total;
cout<<"\n\n ¯The Sum of Even numbers is: "<<EVEN;
cout<<"\n\n ¯The Sum of Odd numbers is: "<<ODD;
cout<<"\n\n ¯The Sum of +ve numbers is: "<<Positive;
cout<<"\n\n ¯The Sum of -ve numbers is: "<<Negative;
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int i,EVEN=0,ODD=0,Total=0,Positive=0,Negative=0,L,S,q=1;
gotoxy(32,2);
cprintf("Program to find:-");
gotoxy(32,4);
cprintf(" Largest number");
gotoxy(32,5);
cprintf(" Smallest number");
gotoxy(32,6);
cprintf(" Sum of Odd and Even number");
gotoxy(32,7);
cprintf(" Sum of +ve and -ve number");
gotoxy(32,9);
cprintf("* To stop program Enter \"0\"");
gotoxy(10,10);
while(i!=0)
{
cout<<"\nEnter "<<q<<" number: ";
cin>>i;
if(q==1)
{
L=i;
S=i;
}
else
{
if(L<=i)
L=i;
else if(L>i)
L=L;
if(S>i)
S=i;
else if(S<=i)
S=S;
}
if(i%2==0)
EVEN=i+EVEN;
else
ODD=i+ODD;
Total=Total+i;
if(i<0)
Negative=Negative+i;
else if(i>0)
Positive=Positive+i;
q++;
}
cout<<"\n\n ¯The Largest number is: "<<L;
cout<<"\n\n ¯The Smallest number is: "<<S;
cout<<"\n\n ¯The Total sum is: "<<Total;
cout<<"\n\n ¯The Sum of Even numbers is: "<<EVEN;
cout<<"\n\n ¯The Sum of Odd numbers is: "<<ODD;
cout<<"\n\n ¯The Sum of +ve numbers is: "<<Positive;
cout<<"\n\n ¯The Sum of -ve numbers is: "<<Negative;
getch();
}
===========================================================================
No comments:
Post a Comment