## Apr 24, 2020

### C program to print given data in ascending order

Ex: What is the logic to print given number in ascending order. How to print given array elements in ascending order. C program to print given  array elements in ascending order.

### C program to print given data in ascending order:

#include<stdio.h>
void main()
{
int a[]={5,2,7,1,9,10};
int i,j,temp=0;
/*Find size of array a*/
int length=sizeof(a)/sizeof(a);
//Run loops
for(i=0;i<length;i++)
{
for(j=i+1;j<length;j++)
{
if(a[i]>a[j])
{
/*Use swaping logic*/
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("Data in asending order is = ");
for(i=0;i<length;i++)
printf("%d ",a[i]);
}

Above program shows the following output:

### C program to print given number is even or odd using bitwise AND operator

Ex: How to find given number is even or odd using bitwise AND operator. C program to print given number is even or odd using bitwise AND operator. What is the logic to print given number is even or odd using bitwise  operator.

Input from user:

Enter the number
5

Expected Output:

Given number is Odd

### Logic to print given number is even or odd using bitwise operator:

Firstly you need to know how bitwise AND operator works. We can use bitwise AND (&) operator to check given number is even or odd. For example, consider one odd number ( 5 ).  So binary of 5(0101), (5 & 1 = 1). Means least significant of every odd number is 1. Therefore (Odd number & 1) is  always one and also (Even number & 1) is zero.

Below program we will use bitwise AND operator to check whether given number is even or odd.  [if(no & 1)] means if this condition is true then number is odd otherwise number is even. Because List significant Bit(LSB) of every odd number is 1 and even number is 0. Which will shown above.

### Program to print given number is even or odd using bitwise AND operator:

#include<stdio.h>
void main()
{
int no;
printf("Enter the number\n");
scanf("%d",&no);
if(no & 1)
printf("Given number is Odd\n");
else
printf("Given number is Even\n");
}

## Apr 23, 2020

### If-Else Statements in C Exercises and Solutions

The if-else statement executes a block of code if a specific condition is true. If the condition is false then it executes another block of code which is shown in below flow chart.

## Apr 11, 2020

### C program to print addition, subtraction, multiplication and division of given two numbers

Ex: Write a C program to print addition,  subtraction, multiplication, division of given two numbers. How to print addition, subtraction, multiplication, division of given two numbers. C program to print addition, subtraction, multiplication, division of given two numbers.

Input from user:
Enter values of a & b: 15  10

Expected output:
Subtraction is: 5
Multiplication is: 150
Division is: 1.0000

### Step by step logic of the given program:

1. Accept input two numbers from user declare variable a & b.

2. Add two numbers and store it in some variable say sum, Subtraction of numbers store in variable sub, multiply  two numbers store it in variable mult and last devide number and store it in float variable div.

3. Print sumsubmult and div on the output screen.

## Program to print addition, subtraction, multiplication and division of given two numbers:

/***program to print addition, multiplication, subtraction and division***/

#include<stdio.h>
void main()
{

int a,b,sum,sub,mult;
float div;//variables declaration

//accept input from user
printf("Enter the value of a & b\n");
scanf("%d%d",&a,&b);

// logic to print addition, subtraction, multiplication and division
sum=a+b;

sub=a-b;

mult=a*b;

div=a/b;

//display subtraction
printf("subtraction is %d\n",sub);

//display multiplication
printf("multiplication is %d\n",mult);

//display division
printf("division is %f",div);

}

Above program shows the following output:

Share your thoughts below in the comment section... :)

### C program to print division of given two numbers

Ex: Write a C program to accept two numbers from user and display division of this two numbers to the output screen.  How to print division of two numbers. C program to print division of two numbers.

Input from user:
Enter the value of a&b:
20 5

Expected output:
division is: 4.0000

## Step by step logic of the given program:

1.  Accept two numbers from user declare variable say a & b.

2. Devide the number and store division in float variable c.

3. Print division on the output screen.

## C program to print division of given two numbers:

/***C program to print division of two numbers***/

#include<stdio.h>
void main()
{
int a,b;
float c;//declaration of variables

//Get input from user
printf("Enter the value of a and b\n");
scanf("%d%d",&a,&b);

c=a/b;//logic for devide two numbers

printf("division is %f",c);//display division
}

Above program shows the following output:

## Apr 10, 2020

### C program to print subtraction of given two numbers

Ex: Write a C program to print Subtraction of given two number. How to print subtraction of given two numbers. C Program to print subtraction of two numbers.

Input from user:
Enter the value of a and b:
50 20

Expected output:
Subtraction is: 30

### Step by step logic of the given program:

1. Accept two numbers from user declare variables say a and b.

2.subtract b from a(a-b) and store subtraction in variable c.

3. Print Subtraction on the output screen:
printf("Subtraction is %d",c);

## C program to print subtraction of given two numbers :

/***C program to print subtraction of two numbers***/

#include<stdio.h>
void main()
{
int a,b,c;//declear three intiger type variables

//Get input from user
printf("Enter the value of a and b\n");
scanf("%d%d",&a,&b);

c=a-b;//subract b from a

//display subtraction
printf("Subtraction is %d",c);
}

Above program shows the following output:

### Basic C programming exercises and examples with solution

C programming language is easy to learn... Although numerous computer languages are used to write computer applications, the computer programming language C is the most popular language in worldwide.

C programming language is best and interested to know how a computer programs works internally.

If you are beginner or interested in programming or you wan't to learn C programming then codeforhunger is for you.
I am sure you will find these exercises and examples interesting and useful to gain your C programming language knowledge.

Here, we will start from basics to advance. With lot of exercises and examples with there solutions.

## Basic C Programming Exercises and Examples:

Feel Free to share your doubts in the comment section given below... :)

## Apr 8, 2020

### Bitwise Operators In C, Exercises and Examples with Solution

In the C Programming language, operations can be performed on a bit level using bitwise operators. We use bitwise operators to manipulate data  at its lowest bit level. bitwise operators works on each bit of the data.

Definition: A bitwise operator is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits.
Bitwise operators are used in communication stack.

### There are six bitwise operators are in C programming:

Above table shows six bitwise operators used in C programming language.

### Bitwise Operators In C:

1. Bitwise AND
2. Bitwise OR
3. Bitwise XOR
4. Bitwise Complement
5. Bitwise left shift
6. Bitwise right shift

For more details:- bitwise operators .

## Apr 1, 2020

### Types Of Jobs In IT Field (Part-time Jobs)

In this article, we will look at the different types of jobs available in the IT industry and explore part-time job opportunities. We will discuss the roles, skills needed, and the benefits of working part-time in IT. You can find a variety of roles in areas like technical support, web development, cybersecurity, and data analysis. These jobs cater to different interests and skills. Photo by

## Jobs In IT

There are different types of jobs available in IT industry some of that are...
1. Mobile application developer..
2. Web developer...
3. Software engineer...
4. Full-stack developer
6. IT consultant...
7. Game developer (programming and designing in gaming).
8. Data Scientist
9. Cyber security
10. Web administrator and many more......

### Which part-time job is best?

If you are an IT student or a programmer, doing an internship in an IT company is the best part-time job for you. Additionally, you can also pursue other opportunities such as...
• IT Intern
• Software Tester
• Freelance web developer
• Freelance IT consultant
• IT support Technician
• Content writer/Editor
• Home Tutor

These are the part-time jobs you can do while pursuing your studies. Engaging in part-time IT jobs not only allows you to earn income but also enables you to develop a deeper understanding of the industry, gain hands-on experience, and build a professional network. Additionally, focusing on programming as a student can lay a solid foundation for a successful career in programming and open doors to a wide range of opportunities.