C languageC SolutionChapter 4Programming

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

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

One thought on “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.

  • Himanshu Soni

    Why you don’t put else if inside the first for loop

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.