Wednesday, November 24, 2010

First C Program...

Well guys!.......Greetings..!

I am sorry as i could not write a new post but today we gonna be read Character Variables. The first thing for character variable is it should be a character and write like 'a', if you want declare a character variable then you need to write it like-

void main()

{

char b;

b='C'

------

------

}

Maximum character length should be one character.

Now i know you are thinking how to construct variable name.....OK....lets read below:

1-variable name is any combination of alphabets and numbers.

2-first character should be an alphabet or an underscore.

3-No comma or blanks are allowed to construction of a variable.

Ex.-

sum_numbers

so_int

a_sex

b_a_46

and now you have learnt How to construct the variables so please read C keywords-

you are thinking what is C keywords, keywords are the certain words whose meaning already known by compiler, key words can't be used as variable name .....hehe note it, there are 32 key words in C-

auto double int struct

break else long switch

case enum register typedef

char extern return union

const float short unsigned

continue for signed void

default goto sizeof volatile

do if static while

SO after learning all the basic things now we will make a first C program.......(if there is any query regarding above explained details kindly mail me)

Input for your first C program-

And Output would be-

1- #include is a header file which means compiler already know about header files.

2- void main () is collective name given to a set of statements.

3- A pair of braces {} shows statement by void main().

4- We used printf("....") for print, that means output screen print.

5- ";" is to be used on every statment to finish it...you will know ablut it in next programs.

Another Program for calculate simple interest—

Output-

3 comments:

  1. Well.....Sir you are doing good job i appreciate it.

    ReplyDelete
  2. Well....its hard to search this blog in any search engn.....but still i found it and i appreciate your work Keep it up...

    ReplyDelete