0
help!
Write a program that uses the h file where counting odd numbers in any elementary array will be written.
7 Réponses
+ 4
Where is your attempt?
No readymade codes here. C guys
+ 1
#include <stdio.h>
int main() {
int var;
printf("Enter the value:\n",var);
scanf("%d",&var);
if(var%2==1)
{
printf("your value is :%d \n This is odd number",var);
}
else{
printf(" your value is :%d\nThis is even number",var);
}
return 0;
}
0
my code check numbers
0
I will add a count
0
#include <stdio.h>
#include <stdlib.h>
int main()
{
int arr[100];
int i,size,odd=0;
printf("Enter size of the array\n");
scanf("%d",&size);
printf("\nEnter elements of the array\n\n");
for(i=0; i<size; i++)
{
printf("Enter the element arr[%d] :",i);
scanf("%d",&arr[i]);
}
for(i=0; i<size; i++)
{
if(arr[i]%2==1)
{
odd++;
}
}
printf("Total odd numbers of an array :%d",odd);
return 0;
}
It's my code. How can I get it .h file?