0% found this document useful (0 votes)
68 views2 pages

Sum of Positive Numbers Program

The document describes a C program that reads numbers from keyboard until 999 is entered, sums only positive numbers, and outputs the total sum. The program includes input/output sections and calculates a running total of positive numbers excluding 999.

Uploaded by

RASHMI ACHARYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views2 pages

Sum of Positive Numbers Program

The document describes a C program that reads numbers from keyboard until 999 is entered, sums only positive numbers, and outputs the total sum. The program includes input/output sections and calculates a running total of positive numbers excluding 999.

Uploaded by

RASHMI ACHARYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

/************************************************************************************

Program 5 : Program to read numbers from the keyboard till the user pressed 999 and find the s
sum of only positive numbers.
Name : Ashley R D souza
Class : I BCA
Date : 27/01/2022
***********************************************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,sum=0;
while(n!=999)
{
printf("Enter number");
scanf("%d",&n);

if(n>0 && n!=999)


{
sum=sum+n;
}
}
printf("*****Exit*****\n");
printf("sum of entered number is%d",sum);
getch();
}

OUTPUT

Enter number2
Enter number3
Enter number5
Enter number4
Enter number999
*****Exit*****
sum of entered number is14

Page No
Page No

You might also like