google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to find sum of odd numbers in an array - 2nd puc computer science

Write a c program to find sum of odd numbers in an array

Write a c program to find sum of odd numbers in an array

#include<stdio.h>

#include<conio.h>

void main()

{

int a[10],i,sum=0,n;

printf("How many elements?");

scanf("%d",&n);

printf("Enter the elements\n");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

for(i=0;i<n;i++)

if(a[i]%2!=0)

sum=sum+a[i];

printf("sum=%d",sum);

getch();

}

Write a c program to find sum of odd numbers in an array Write a c program to find sum of odd numbers in an array Reviewed by Vision Academy on December 26, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.