C Program to Implement CONTINUE statement

include

int main()
{
int i, n, a, sq;
printf(“\n\tProgram finds square of positive numbers only\n”);
printf(“\nHow many numbers you want to enter: “);
scanf(“%d”, &n);
for (i=1; i<=n; i++)
{
printf(“\nEnter Number: “);
scanf(“%d”, &a);
if (a < 0)
continue;
sq = a * a;
printf(“\nSquare of a Number : %d\n”, sq);
}
return 0;
}
OUTPUT:
Program finds square of positive numbers only

How many numbers you want to enter: 3

Enter Number: 10

Square of a Number : 100

Enter Number: 25

Square of a Number : 625

Enter Number: 30

Square of a Number : 900

Leave a Reply

Your email address will not be published.