Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- int main() {
- system("cls");
- //INPUT - @STUDENT:ADD YOUR CODE FOR INPUT HERE:
- int a[7], mask[7] = {0};
- int b[7], count[7] = {0};
- int x = 0;
- for (int i = 0; i<7; i++) {
- scanf("%d", &a[i]);
- }
- for (int i = 0; i<7; i++) {
- if (a[i]%2 == 0) {
- mask[i] = 1;
- }
- }
- for (int i = 0; i<7; i++) {
- if (mask[i] == 0) {
- int j = 0;
- for (j = 0; j<x; j++) {
- if (a[i] == b[j]) {
- count[j]++;
- break;
- }
- }
- if (j == x) {
- b[x] = a[i];
- count[x] = 1;
- x++;
- }
- }
- }
- int maxcount = count[0];
- for (int i = 1; i<x; i++) {
- if (maxcount < count[i]) {
- maxcount = count[i];
- }
- }
- // Fixed Do not edit anything here.
- printf("\nOUTPUT:\n");
- //@STUDENT: WRITE YOUR OUTPUT HERE:
- int y;
- if (x == 0) {
- printf("No odd number.");
- }
- else {
- for (int i = 0; i<x; i++) {
- if (maxcount == count[i]) {
- printf("%d", b[i]);
- y = i;
- break;
- }
- }
- for (int i = y+1; i<x; i++) {
- if (maxcount == count[i]) {
- printf(" %d", b[i]);
- }
- }
- }
- //--FIXED PART - DO NOT EDIT ANY THINGS HERE
- printf("\n");
- system ("pause");
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement