Ab L.

asked • 10/16/17

I need help with this C programming question. Please. :(

Write a C program that allows the user to input exactly 16 integers. The program will count and print the number/amount of:
1) Positive integers 
2) Negative integers
3) Odd integers, and 
4) Even integers
 
I do not know what to do. This is my attempt, but I am stuck:
#include <stdio.h>

int main()
{
int n;
int pos;
int odd;
int i;
for(i=0; i<16 ;i++)
{

scanf("%d", n);
if(n>0)
{
pos++;
}
if(n == 0)
{
odd++;
}
return 0;
}

}

Tony J.

I don't see in this program where you're prompting the user for input. Shouldn't there be a "cin" statement inside a loop, allowing the user to enter 16 numbers into a list?
Report

10/16/17

Tim C.

tutor
Tony, cin is C++
Report

10/16/17

1 Expert Answer

By:

Patrick B. answered • 03/10/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.