Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
mialte
/
kodutoo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
12373fe7
authored
a week ago
by
mialte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 1
parent
6e59ef61
master
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
1
1
View file @
12373fe7
/*
Kirjutage programm, mis sisestab N(N<15,N>3) täisarvu
ja väljastab, kui palju oli paaris ja mitu paaritut.
*/
#include <stdio.h>
int main()
{
int N;
printf("Sisesta N (3<N<15)");
scanf("%d", &N);
if(N <=3 || N>=15) {
printf("N peab olema suurem kui 3 ja v2iksem kui 15. \n");
return 1;
}
int number[N], paarisarv = 0, paarituarv = 0;
printf("Sisesta %d number: \n", N);
for(int i=0; i<N; i++) {
scanf("%d", &number[i]);
if (number[i] % 2 ==0) {
paarisarv++;
} else {
paarituarv++;
}
}
printf("Paaris arvud: %d\n", paarisarv);
printf("Paaritud arvud: %d\n", paarituarv);
return 0;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment