===========================================================================
CODING
#include<all.h>
void main()
{
int n=0,SUM=0,sum=0,i=1,N=0;
label:
clrscr();
cout<<"\nEnter number: ";
cin>>n;
if(n<2)
{
cout<<"\nWrong Input! TRY Again\nPlease wait while Reloading......";
delay(2000);
goto label;
}
else;
cout<<"\n\n\n";
do
{
cout<<"\n ►Enter number \""<<i<<"\": ";
cin>>N;
if(N>=0)
sum=N+sum;
else
SUM=N+SUM;
i++;
}while(i<=n);
cout<<"\n\n¯Sum of +ve numbers is "<<sum;
cout<<"\n¯Sum of -ve numbers is "<<SUM;
getch();
}
CODING
#include<all.h>
void main()
{
int n=0,SUM=0,sum=0,i=1,N=0;
label:
clrscr();
cout<<"\nEnter number: ";
cin>>n;
if(n<2)
{
cout<<"\nWrong Input! TRY Again\nPlease wait while Reloading......";
delay(2000);
goto label;
}
else;
cout<<"\n\n\n";
do
{
cout<<"\n ►Enter number \""<<i<<"\": ";
cin>>N;
if(N>=0)
sum=N+sum;
else
SUM=N+SUM;
i++;
}while(i<=n);
cout<<"\n\n¯Sum of +ve numbers is "<<sum;
cout<<"\n¯Sum of -ve numbers is "<<SUM;
getch();
}
===========================================================================
No comments:
Post a Comment