C Program for beginners
keywords: example of Structure of a C program, EXAMPLE OF STRUCTURE OF A C PROGRAM, example ofstructure of a c program, example of structure of a c++ program, c++ program structure, how to write structure of a c program, how to write user friendly structure of a c program, user friendly structure of a c program for beginner, user friendly program, easy structure of a c program, user structure of a c program, c program to write user friendly structure of a c program, c language to write structure of a c program, c++ user structure of a c program, c++ structure of a c program, structure, c program, c, c++
simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, google, google love you, use google, best search engine google, make money with google, google friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.
Examples of C program
|
The structure of a c program is quite different from other languages, but before writing the code(from other examples) you should know what to write , where to write,how to write and what the code signifies. So it is very important to know the structure of a typical C program.
If you are new to C language then without wasting time Visit this link. Because if you learn from beginning then only it will be beneficial for you and it will not take more than half an hour to learn the basics.
To know how to write and where to write the main structure of a C program visit this link.
To download application to write C/C++ program visit this link.
To get the list of all C programs for beginners visit this link.
|
C language does not actually follow any specific method of writing a program. It is a case sensitive language. All the statements must be written in lower case letters. The structure of a C program is as follows.
C program to find sum of two numbers
Structure
|
Code*
|
<Header file>
|
#include<stdio.h>
|
<Global declaration>
| |
main()
|
main()
|
{
|
{
|
<local variables>
|
int a,b;
|
<statements>
|
printf(“Enter two nos.: ”);
|
scanf(“%d%d”,&a,&b);
| |
printf(“sum: %d”,a+b);
return 0;
| |
}
|
}
|
<sub programs – function blocks>
|
*Here only basic is shown, and we hope beginners will be able to follow this.
C program to print numbers up to ‘n’.
Structure
|
Code*
|
<Header file>
|
#include<stdio.h>
|
<Global declaration>
| |
main()
|
main()
|
{
|
{
|
<local variables>
|
int i,n;
|
<statements>
|
printf(“Enter a no.: ”);
|
scanf(“%d”,&n);
for(i=1; i<=n; i++)
| |
printf ("%d",i);
return 0;
| |
}
|
}
|
<sub programs – function blocks>
|
*Here only basic is shown, and we hope beginners will be able to follow this.
C program to print area of square.
Structure
|
Code*
|
<Header file>
|
#include<stdio.h>
|
<Global declaration>
| |
main()
|
main()
|
{
|
{
|
<local variables>
|
int n;
|
<statements>
|
printf(“Enter lenght: ”);
|
scanf(“%d”,&n);
| |
printf ("Area = %d",n*n);
return 0;
| |
}
|
}
|
<sub programs – function blocks>
|
*Here only basic is shown, and we hope beginners will be able to follow this.
C program to print area of circle.
Structure
|
Code*
|
<Header file>
|
#include<stdio.h>
|
<Global declaration>
| |
main()
|
main()
|
{
|
{
|
<local variables>
|
int l,dia;
|
<statements>
|
printf(“Enter length: ”);
|
scanf("%d",&l);
dia=sqrt(l*l+l*l);
| |
printf ("Diagoanal length = %d",dia);
return 0;
| |
}
|
}
|
<sub programs – function blocks>
|
*Here only basic is shown, and we hope beginners will be able to follow this.
1. The header files or prepocessor directive give instruction to the compiler to include compiler options (#include), Marco substitution (#define) to substitute a constant for an identifier and conditional (#ifdef) directives.
2. The main statement block and other blocks used in a c program are enclosed in braces{}
3. Variables declared outside the main () are called global variables, are they can be used in the main program block and sub program block.
4. Variables declared inside main() are called local variables, and they are used only in the blocking which they are declared. Sub programs/functions can also have local variables
5. Any c program has coding in the form of letters and symbols. Normally documentation to the program is made by adding remarks or comment line enclosed in /*and */ OR by using // wherever necessary.
keywords: example of Structure of a C program, EXAMPLE OF STRUCTURE OF A C PROGRAM, example ofstructure of a c program, example of structure of a c++ program, c++ program structure, how to write structure of a c program, how to write user friendly structure of a c program, user friendly structure of a c program for beginner, user friendly program, easy structure of a c program, user structure of a c program, c program to write user friendly structure of a c program, c language to write structure of a c program, c++ user structure of a c program, c++ structure of a c program, structure, c program, c, c++
simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, google, google love you, use google, best search engine google, make money with google, google friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.
sample codes about c language Simple Snake game
ReplyDelete