Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int oddcount = 0;
- int evencount = 0;
- int x, min = 999;
- do
- {
- printf("Enter an integer (0 to end):");
- scanf("%d",&x);
- if( x != 0) {
- if (x < min){
- min=x;
- }
- if (x%2==0){
- evencount++;
- }
- else{
- oddcount++;
- }
- }
- }
- while (x!=0);
- if(oddcount > 0){
- printf("The count of odd num is:%d\n",oddcount);
- }
- else{
- printf("The count of odd num is: 0\n");
- }
- if(evencount > 0){
- printf("The count of even num is:%d\n",evencount);
- }
- else{
- printf("The count of even num is: 0\n");
- }
- if(min == 999){
- printf("Min value: None\n");
- }
- else{
- printf("Min value: %d\n", min);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment