C program to check even or odd using functions

Write a C program to input a number from user and check whether given number is even or odd using functions. How to check even or odd using functions in C programming. Write a function in C programming to check even or odd.

Example

Input

Input any number: 10

Output

10 is even

Read more

C program to find maximum and minimum using functions

Write a C program to input two or more numbers from user and find maximum and minimum of the given numbers using functions. How to find maximum and minimum of two or more numbers using functions in C programming.

Example

Input

Input two numbers: 10
20

Output

Maximum = 20
Minimum = 10

Read more

C program to find power of a number using recursion

Write a C program to input a number from user and find power of given number using recursion. How to find power of a number using recursive function in C programming. Logic to find power of a number using recursion in C programming.

Example

Input

Input base number: 5
Input power: 2

Output

2 ^ 5 = 25

Read more

C program to find cube of a number using function

Write a C program to input any number from user and find cube of the given number using function. How to find cube of a given number using function in C programming. Write a C function to find cube of a given number.

Example

Input

Input any number: 5

Output

Cube of 5 = 125

Read more

C program to swap first and last digit of a number

Write a C program to input a number from user and swap first and last digit of the given number. How to swap first and last digits of a number in C programming. Logic to swap first and last digit of a number in C program.

Example

Input

Input any number: 12345

Output

Number after swapping first and last digit: 52341

Read more

C program to sort even and odd elements of array separately

Write a C program to input elements in an array from user and sort all even and odd elements of the given array separately without using any other array. If minimum element of the array is even then all even elements should be placed in sorted order before odd elements otherwise all odd elements should be placed first. How to sort all even and odd elements of a given array separately in C programming.

Example

Input

Input size of array: 10
Input elements of array: 0 5 1 2 3 4 6 12 10 9

Output

Output in sorted order: 0 2 4 6 10 12 1 3 5 9

Read more

C program to put even and odd elements of array in two separate array

Write a C program to input elements in array and put even and odd elements in separate array. How to separate even and odd array elements in two separate array containing only even or odd elements using C programming.

Example

Input

Input size of the array: 10
Input elements in array: 0 1 2 3 4 5 6 7 8 9

Output

Output even elements in array: 0 2 4 6 8
Output odd elements in array: 1 3 5 7 9

Read more

Bitwise operator programming exercises and solutions in C

Data in the memory (RAM) is organized as a sequence of bytes. Each byte is a group of eight consecutive bits. Bitwise operators are useful when we need to perform actions on bits of the data.

C supports six bitwise operators.

  1. Bitwise AND operator &
  2. Bitwise OR operator |
  3. Bitwise XOR operator ^
  4. Bitwise complement operator ~
  5. Bitwise left shift operator <<
  6. Bitwise right shift operator >>

This exercises focuses on mastering bitwise operators. After this exercise you will surely gain some confidence using bitwise operators.

Read more