1
Topic content:
Your program reads a series of positive integer data, input 1 indicates the end of the input, and 1 is not the input data itself. The number of odd and even numbers in the data read by the program output.
Input format:
A series of positive integers in which the range of integers is (0,100000). If input-1 indicates the end of the input.
Output format:
Two integers, the first integer representing the number of odd numbers in the read data, and the second integer representing the number of even numbers in the read data. Two integers are separated by a space.
Input Sample:
9 3 4 2 5 7-1
Sample output:
4 2
Time limit: 500ms memory limit: 32000kb
main.c// C yuyan//// Created by Anzhongyin on 2016/11/29.// Copyright 2016 anzhongyin. All rights reserved.//#include <stdio.h>int main (int argc, const char * argv[]) { //Insert code here ... int Inter; int a=0; int b=0; scanf ("%d", &inter); while (Inter!=-1) { if (inter%2==0) { a++; } else { b++; } scanf ("%d", &inter); } printf ("%d%d\n", b,a); return 0;}
Use case test Results |
Run time |
Memory consumption |
Tips |
Score |
Use Case 1 by |
1ms |
128kb |
|
1 |
Use Case 2 by |
1ms |
256kb |
|
1 |
Use Case 3 by |
1ms |
128kb |
|
1 |
Use Case 4 by |
25ms |
256kb |
|
1 |
Use Case 5 by |
1ms |
256kb |
|
1 |
Submit an Answer
Score/Score:5.00/5.00 min
Introduction to Programming--c Language 3rd week programming Exercise 1 Parity number (5 points)