WAP To Print Hello, Easy Step To Learn C Programming, How To Write C Program, Learn C Programming Online
Write A Program To Print "HELLO" Word And Add 2 nos.This is the program
1. #include <stdio.h>
2. #include<conio.h>
3. void main() // main function - here our program start exctuion
4. {
5. int a=2,b=3;
6. clrscr(); // To clear the screen or To remove previous result
7. printf("Hello CSE-IT-LIVE-PROJECTS"); // print function
8. getch(); // To hold the output screen
9. }
In the above program you can see that the output is "Hello CSE-IT-LIVE-PROJECTS"
Now i am going to explain you line by line thats why i am giving numbering line by line, no need to write the numbers in your editor otherwise it shows error. so
1. In this line i am declare the header file. Here # is used to link header files to the functions. include is a preprocesser sub directory it gives the address to the # so he link the header files to there functions. and < > sign is the syntax of declaration of heare files. and stdio is standard input output it is used to perform input & output operation in console. and .h is the extension of header file.
What is header file: header file is a computer file that allows developers to separate certain elements of a program's source code into reusable codes
2. #include<> i am already explained. and conio is used to perform console operations like clear screen (clrscr()), to hold the screen (getch()). and conio = console input output.
3. Void tell us about the program return type, what kind of value our program returning to us. and main() is a function where our program starts execution. It tells editor to start execution form here so in every c program there is only a single main function.
4. { this is used to separate our programs in a block
5. Then i am declared 2 variables named as a & b, before declaration i write int means integer, those value we are going to declare that is integer type . In mathematics when we write a=2 it means the value of a is eqal to 2. but in c when we write a=2; it means we storing the value (2) in a variable and the value of a is 2. now same as b here the value of b is 3. and its not compulsory to write the variable name only a or b. For Variable name rules you can read here Click Here. In last there is ; it tell us our program line is end. if we write after this then c understand it is in next line.
6. clrscr(): This is a function it clear the previous data. when we run c program then it shows the output if we run 2-3 times then it display all 2-3 outputs. so for avoiding previous outputs we write clracr() clear screen in c program so it display fresh value.
7. printf(): printf is used to print the output in screen or console. full form of printf() is print function.
8. getch(): getch() is used to hold the output screen, without getch() we can't see the output. our output screen display for some micro second. so for holding the screen till we want we use getch().
9. } This is the closing braces. it close the open braces.
Keyword: Explain C Program Line By Line, WAP In C And Explain, Program Of C, Technical Interview Questions With Answers, Interview Questions With Answers, C Interview Questions,


0 comments:
Post a Comment
Thanks For Your Comment. We Get Back To You As Soon As Possible.