C Language program to count even and odd number in an array

Question : Write a program to count even and odd number in a array ?
i.e.
     Input : 1 4 5 3 5 6
     Output : Event Number : 2
                   Odd Number  : 4

Answer :

#include<stdio.h>
void main()
{
int ar[5],even,odd,i;
for(i=0;i<5;i++)
{
printf("Enter Number>> ");
scanf("%d",&ar[i]);
}
for(even=0,odd=0,i=0;i<5;i++)
{
if(ar[i]%2==0)
even++;
else
odd++;
}
printf("\n\tEvent no is %d\n\tOdd No. is %d",even,odd);
}

Practical Question paper of C Language


One Dimension Practical model question paper

Q 1. Write a  program to shift array element with next one . Last element will replace with first element ?


Q 3.Write a program to make three array name mArry, even & odd move array value in even & odd array respect to this type ?

Q 4.Write a program to find smallest and highest number from an array?

Q 5. Write a program to print an array in reverse order?

Q 6. Write a program to print only consecutive number of an array?

Q 7. Write a program to implement union and intersection?

Q 8. Write a program to merge two array into a single array?

Q 9.Write a program to spilt an array into two equal parts ?

Q 10. Write a program to input Fibonacci into array?

Q 11.Write a program to find out prime number between given range and saved these number into array. Range should be up-to 1 to 10000 ?

Q 12.Write a program to input 10 numbers and print each element with multiply by its equivalent index position?

Q 13. Write a program to print an array value without using loop ?

Q 14.Write a program search a number in array ?

Q 15.Write a program to print an array value skip by one index?

Q 17. Write a program to input ASCII value and print its equivalent character.Using 7 bit ASCII/

One Dimension Character Array  Programs

1. Write a program to count Vowels and consonant?

2. Write a program to count no. of word in an array?

3. Write a program to convert lower case character into upper case

4. Write a program to print only consecutive appeared character

5. Write a program to implement concatenation?

6.  Write a program to implement substring function type functionality

7. Write a program to input small letter if capital letter is there ignore that

8. Write a program accept any case input and convert it small case

9. Write a program input character only and display error message on any other input?

10. Write a program to search a substring and print its index

11. Write a program to search a word and reverse that

12. Write a program implement encryption i.e. change each character to two character forward. i.e.   A-> C,B->E

13. Write a program to implement following format
              G                                              GIRFA
              GI                                             GIRF
              GIR                                          GIR
              GIRF                                        GI
              GIRFA                                     G

14. Write a program to implement abbreviation i.e.
Input : Ashok Kumar Yadav
Output : A.K. Yadav

15. Write a program to implement find and replace all functionality

16. Write a program to check whether a string is palindrome or  not

17. Write a program reverse a string

18. Write a program to reverse each word into array

19. Write a program to input string password. i.e.(A Small and Capital character , A number and a special symbol)

20. Write a program to check validity of an email address. (an email can have only one @ symbol after that . is required and no space is allowed)

21. Write a program count frequency of each character individually.
   i.e.    123
            One Hundred Three Only

No comments:

Post a Comment