Created
September 29, 2013 12:04
-
-
Save qassa/6751957 to your computer and use it in GitHub Desktop.
//найти количество четных чисел в промежутке между целыми
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<conio.h> | |
#include<stdio.h> | |
int countChet (int n, int y){ | |
int i=0,h=0,max,min; | |
if(n>y){ | |
max=n; min=y; | |
} else { | |
max=y; min=n; | |
} | |
for(i=min;i<=max;i++) | |
if(i%2==0) h++; | |
return h; | |
} | |
int main (){ | |
int x,c,f; | |
scanf("%d%d",&x,&c); | |
f=countChet(x,c); | |
printf("%d",f); | |
getch(); | |
return 0; | |
} | |
//найти количество четных чисел в промежутке между целыми |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment