help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help!

Write a program that uses the h file where counting odd numbers in any elementary array will be written.

9th Dec 2020, 2:18 PM
Nika kachibaia
Nika kachibaia - avatar
5 Answers
+ 4
Where is your attempt? No readymade codes here. C guys
9th Dec 2020, 2:23 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 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; }
9th Dec 2020, 2:44 PM
Nika kachibaia
Nika kachibaia - avatar
0
my code check numbers
9th Dec 2020, 2:44 PM
Nika kachibaia
Nika kachibaia - avatar
0
I will add a count
9th Dec 2020, 2:45 PM
Nika kachibaia
Nika kachibaia - avatar
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?
9th Dec 2020, 3:00 PM
Nika kachibaia
Nika kachibaia - avatar