Saturday, 4 October 2014

IF - ELSE STATEMENT

This If - Else statement comes in the decision taking group. It is the basic part of the decision taking group. 

Syntax:

if(condition)
       statement1;
else
       statement2;


Write program to add two integer number in run time value

INPUT

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

void main()

{
                int a,b,total;

                printf("Enter the value of a:");
                scanf("%d",&a);
                printf("Enter the value of b:");
                scanf("%d",&b);
                total=a+b;
                printf("The sum is %d",total);
                getch();
}

OUTPUT :

Enter the value of a: 4
Enter the value of b: 5
The sum is 9

 
 

Friday, 3 October 2014

Understanding the structure of basic program

We have seen the structure of C language it was the basic one but important to know in detail to learn more about C language.

The starting of the C program is done by the file:
           #include<stdio.h>
It is known as header file known as standard input output file and ".h" is the extension for the header file. This file is important because without it program cannot be defined.

Thereafter  the function "main()" is used. It makes the compiler know that the program is going to be started and without this function output cannot come , it is one of the main functio of the file without it program cannot be runned.

Now you can see curly brackets "{" under the main function it indicates the starting of the program. The content of the program is written inside this curly bracket . 

Now we can see the line printed inside the "/*........*/" . It indicates the comment kept by the programmer to make other programmer understand the program. In fact the comments are of two types
1. /*.............*/ - Single line comment
2. //...............   - Double line comment
There is no much difference between both of them.

Then we can see the line inside "printf( ....);" .It is the statement given to the compiler to print and the ";" is the necessary symbol needed to complete that statement otherwise it will show error at the time of compiling.

The "getch();" is the function needed for the completion of program but it is not every time necessary to write.

This was all about the structure of C language program of basic .

NOTE:- To know more about the C language continue reading this blog - KING's BLOG.

Thursday, 2 October 2014

About basic C language history

The C language is the language that cannot be learned easily but very much soft to feel because it is made for feelings..  As we know the characteristics of the software is not audible but it can be filed same way the C language is too software based language so it can only be feeled.

The history of C language is very much interesting that it was developed by the scientist DENISE RICHIE in the bells laboratory in 1969.

This made the life of programmers very much easy and because they were using many hard language to make the programs so they were facing the problems with the errors in that but with the step of C language the problems became very much easy for all programmers. It was the first portable language that was ever developed in past which means it can be written on any machine and run on any machine .

STRUCTURE OF C LANGUAGE:


Here we are going to type one simple and basic program.

INPUT:

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


void main()

{

          /*Start of program.......................*/
                printf("WELCOME TO THE KING's BLOG");
                getch();
          /*End of the program..................*/
}

OUTPUT:


WELCOME TO THE KING's BLOG

NOTE :- To know more about C language continue reading this blog -   THE KING's BLOG