Monday, April 27, 2009

The if statement

The if statement is very common in most of the computer languages. Alike C also reserve this keyword to implement the decision control instruction.
The syntax of this instruction is as follows:
if( The condition = True )
  execute the statements;


Sunday, April 26, 2009

Decision Control Structure

In the previous blogs we have learnt about the different basic requirement to write a C program, now as we move forward we will learn about the different techniques of to write a C program. In this blog we will learn about the decision control structure of C program. Here we will learn about what is decision control structures and decision control algorithms.

Sunday, April 19, 2009

Program to interchange the last and first digit of a four digit number

Exercise 11

A four digit number is entered through the keyboard and the first and the last digit of the number is interchanged, and the new number so formed will be displayed to the user.

Solution:

#include<stdio.h>
#include<conio.h>

Saturday, April 18, 2009

Program to find the sum of last and first digit of a four digit number

Exercise 10

If a four digit number is input through a keyboard, write a program to obtain the sum of the first and last digit of this number.

Solution:

#include<stdio.h>
#include<conio.h>

Friday, April 17, 2009

Program to reverse the number

Exercise 9
If a five digit number is input through the keyboard, write a program to reverse the number.
Solution:

/* Program to reverse the number of a five digit number */
#include<stdio.h>
#include<conio.h>
#include<math.h>

Thursday, April 16, 2009

Program to sum of the digits of a five digit number.

Exercise 8
If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.
(Hint: Use the modulus operator ‘%’)
Solution:

/* Program to sum of the digits of a five digit number */
#include<stdio.h>
#include<conio.h>

Wednesday, April 15, 2009

Program to interchange or swap the content of two variables (without the use of third variable)

Exercise 7
Two numbers are inputted through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.(Without the help of 3rd variable)
Solution:

#include<stdio.h>
#include<conio.h>

Tuesday, April 14, 2009

Program to interchange or swap the content of two variables (with the use of third variable)

Exercise 6
Two numbers are inputted through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.(With the help of 3rd variable)
Solution:

#include<stdio.h>
#include<conio.h>

Monday, April 13, 2009

Exercise Solving 5

Exercise 5:
The length and breadth of a rectangle and radius of a circle are input through the keyboard. Write a C program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.
Solution:

#include<stdio.h>
#include<conio.h>

Sunday, April 12, 2009

Exercise Solving 4

Exercise 4:
Temperature of a city in Fahrenheit degree is input through the keyboard. Write a program to convert this temperature into centigrade degree.
Solution:

#include<stdio.h>
#include<conio.h>