Q7 Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered.
Program: 100
Write a c program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered.
First Method:
Output:
Enter Numbers: 5 -1 2 -4 -5 0 Positive Numbers: 1 Negative Numbers: 3 Zero Numbers: 1
Second Method
Output:
Enter a number: -4 Do you want to Continue(y/n)? y Enter a number: 0 Do you want to Continue(y/n)? y Enter a number: 7 Do you want to Continue(y/n)? y Enter a number: -45 Do you want to Continue(y/n)? y Enter a number: 12 Do you want to Continue(y/n)? n Positive Numbers :2 Negative Numbers :2 Zero Numbers :11
Why you don’t put else if inside the first for loop