# What Will be the Output of the following C Program

Every programmer is familiar to the function printf(); but there is also many things, everybody dons know.

Let’s Try to Predict the output of the program ►► Continue reading What Will be the Output of the following C Program

Advertisements

# C Program to Find Whether the Number is Even or Odd

We all know, the number which can divide from 2 completely, means if the reminder is zero, then the number is even and which cannot are odd numbers.

The same we will do in our program to know whether the number, which is input through the keyboard, is even or odd.

Remember the modulus operator (%), this operator returns the reminder, when dividing any number. So we will condition the if statement, if the reminder is zero after diving the number by 2, then the number is even otherwise odd.

Let’s have ah Look The Program ►► Continue reading C Program to Find Whether the Number is Even or Odd

# C Program to Use Printf(); Function Without The Semicolon

We all know, every statement in C is terminated by semicolon (;). The same apply to printf(); function.

Suppose we are going to print Lightning Code on the screen than statement for it will be printf(“Lightning Code”); but what if we want to print it without the semicolon after printf. Think about it, how can you do it, I know, you know how can but you did’t notice it.

Let me give you a hint, when we use if(); statement to condition something, we never use the semicolon inside the parenthesis. Now I am sure you make it out.

Let’s Have Ah Look at Program ►► Continue reading C Program to Use Printf(); Function Without The Semicolon

# C Program to Find Factorial of a Number

Hello Readers 🙂 Hope you are getting valuable posts. If you have any query or want to know about any program, Let Me Know, I’ll love to help you out. And Keep Learning.

Now I am going to write a program to find the factorial of a number. Factorial of a number is the multiplication of all numbers lower than it and greater than zero as factorial of 5 will be 5*4*3*2*1=120.

Let’s Make The Program ►► Continue reading C Program to Find Factorial of a Number

# C Program to Print Out Fibonacci Series upto N Terms

Really for coding one also must learn the Mathematics. There are many programs out there which are totally based on mathematics questions. And I hate maths 😦 Love to coding only 😉

Well Let Face It. Lets make a program to print out Fibonacci series up to N terms. A series of numbers in which each sequent number is sum of its two previous numbers is known as Fibonacci series and each numbers are called Fibonacci numbers.. For example we have to print up to 5 then the series will be 0,1,1,2,3, here every number is the sum of last two numbers.

Lets Have ah Look at the Program  ►► Continue reading C Program to Print Out Fibonacci Series upto N Terms

# C Program to Compare Two Strings Through User-Defined Function

Strings are another good feature of C. They provide a great way to store characters, not in really, in actual C Program stores the ASCII Values of characters that’s why there is no any non-numeric data-type in C. All in hidden, access and manipulate through numeric values. In other words, Strings are arrays of characters.

There are many functions for strings and to compare two strings there is also strcmp(str1,str2); function. Which if the two strings are equal gives the value 0(zero) and otherwise return the ASCII value difference between first non-matching characters.

Lets do it with some trick to eliminate the variables and shorten the size of the program.

Lets Do It with the User-define Program ►► Continue reading C Program to Compare Two Strings Through User-Defined Function

# Single Line C Program for Finding The Elder One Among Three

Remember the Ram, Shayam and Ajay program (from the book Let Us C). This one clears many of my confusions about the if-else ledder. But I din;t satisfied with this one because it;s a lengthy one, not because the program is hard but it takes a little more attention for the nesting of if-else. So I thought to make it short. And tried many ways to achieve what I want. And finally I end up my searching when I learnt about the Conditional Operators ( ?,: ). These operators made me act like OMG :o. These operators actually can do many of coding go simple and I shortened many of my programs with the help of these operators.

Take a Look at the Program ►► Continue reading Single Line C Program for Finding The Elder One Among Three

# C Program to Swap Two Numbers Using XORing Operator

Bit-wise operators give a very tremendous way of working on bit. And the program that needs numbers of statements, and simply done on the single line using bit-wise operator.One of the bit-wise operator, The XORing operator (^) provides a way of swapping the values of two variables easily.

Lets see the Program ►► Continue reading C Program to Swap Two Numbers Using XORing Operator

# C Program to Swap Two Numbers Using Pointers

For me pointers are the only reason I love C Programming. It broadens the concept of programming. And as a programmer I use to do programming through pointers mainly, as it eliminates many limitations of the program smartly. We can’t achieve swapping of two numbers without pointers when we are using a function call because every time actual arguments gets copied and being pass to the function, and becomes the formal arguments of that function. Any change in formal argument won’t make the actual arguments change. So cleverly we can pass the addresses as the formal arguments of the variables and can change the values using addresses.

Look at the Program Carefully ►► Continue reading C Program to Swap Two Numbers Using Pointers