Skip to main content

CONTINUE STATEMENT


Write a program to input ‘n’ number from the user. Number may be ‘-ve’ or ‘+ve’ . calculate the sum of only ‘-ve’ number.

Continue statement is a statement which is used to bypass the current pass of a loop.

Syntax: -

Continue;

Program: -

#include<stdio.h>
#include<conio.h>
void main()
{
int n, num, sum=0, i;
clrscr();
printf("\n enter the number you want to run=");
scanf("%d",&n);
for( i=0;i<n;i++)
{
printf("\n enter the number=");
scanf("%d",&num);
if (num<0)
{
sum= sum+num;
}
continue;
}
printf("\n The sum of numbers is=%d",sum);
getch();
}

Output: -

Enter the number you want to run = (as per user wants)
Enter the number = (as per user say)
The sum of the numbers is =



Comments