UPDATED:

How To Make A Simple Calculator By C Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... Happy Coding.......... This blog is under construction!!!!
Namecheap.com
Showing posts with label The Basic structure of C. Show all posts
Showing posts with label The Basic structure of C. Show all posts

Thursday, June 2, 2016

How to find circle area using πr ² formula in C

πr² is a common formula to us.But can you find a circle area value by C?
if not,try this.It's help you to know how to find/print the value of a circle 
area in C programming language.


Code to print the value:


#include<stdio.h>

#define PI 3.1416

int main()
{
    float circle_area, r;

    printf("Enter the value of radius: \n");
    scanf("%f", &r);

    circle_area = PI *r * r;

    printf("The circle area is: %.2f\n", circle_area);


return 0;

}


OR,


#include<stdio.h>



int main()

{
    float circle_area, r, PI=3.1416;

    printf("Enter the value of radius: \n");

    scanf("%f", &r);

    circle_area = PI * r * r;


    printf("The circle area is: %.2f\n", circle_area);



return 0;


}


The Output is:




Face problems?No problem.You can share your problems by commenting below.or you can leave a massage us.Thank you.

Friday, February 26, 2016

DATA TYPE,VARIABLES,INPUT AND OUTPUT

DATATYPE: C has five types of basic Data.such as int,double,float,char and void.Today we are going to learn int Type data programming.int stand for integer.Integers are 0,1,2,3......

VARIABLES: A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.




The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore.Upper and lowercase letters are distinct because C is case-sensitive.
Now write this program on your compiler:

code:

           #include <stdio.h>

           int main()
           {
               int x,y;
               x = 5;
               y = 6;

               printf("%d",x);

           return 0;
           }

Output: 5



Description of the program: Here i wrote int x,y;. int stand for integer and here i declared two variables x & y.You can declare many variables.You can not write variables like 1x,$a,#x,+y,show-ans etc.You can use this operators or signs or numbers (1,$,+,#) after characters.And you can use show_ans.
In printf function i used "%d" for showing integer which i mentioned after it.

Can you do summation,subtraction,multiplication and division by C?See in my next post.
Thanks for being with coder mania BD.

Friday, February 19, 2016

The Basic structure of C.


If you want to be a good programmer,You need to know the basic structure of a language (C).

In C basically there are two parts.Like Include Files Part & Main function () part.


Include files like header files.There are many header files stored In C language library.such as #include <stdio.h>, #include <math.h>,#include <conio.h> etc.
Main function usually declare the variables and call the library functions,user defined functions.Every C program starts with main ().You can not think C without main ().In C,there can be many functions along with main ().Every function has specific work.
“Other functions” part is under main () function.Main () function call different types of library functions like, clrscr(),getch(),sqrt(),printf(),scanf(). And also call user defined functions.


Now I am going to describe a program sections.


You can write comments in the document section.To write single line comment use // and for multiline comment use /*……*/.
You have to link a header file in the link section.Header files define the library functions and keywords.Header files executes the program.
Symbolic constants are defined in the definition section.
Global variables are declared in the Global variable declaration section.Global variables can be used in several function.
Main function is a function where a program call the library functions and user defined functions.C program starts from compile and executes main() function.

Main function consist of two parts:

(1)Declaration part:- It declare all variables which are used in executable part.

(2)Executable part:- Executable part contains with  minimum one statement.


There is a Demo program for you:


#include <stdio.h>
int main ()
{
    printf("Hello World.");

 return 0;
} 



Be continue.......
Namecheap.com

Popular Posts