Tuesday, March 5, 2019

Basic C Language Tutorial for beginners

I'm telling you about Some Basic Programming Languages in Computer Science Feild. So, guys, there are many Basic Programming Languages to begin to start your career in Web development.

Today I teach you C Language. according to www.tiobe.com C Language is the second number of Top Programming Languages in the Wolrd.

There are some basic programming languages.


  • Fortran
  • COBOL
  • Pascal programming language
  • C++
  • Java
  • Visual Basic
You may also learn basic from the above-mentioned Languages.



Why I  Use C Langauge Programming for Basic?

This is true and no doubt that is the second top in the list and this is so simple and easier than other languages by my opinion. this is also can easily work on a simple note pad.

How it is Work.

it's work simply and also need an interpreter like (Dev C ++ ) because you should practice on the compiler. So you can improve your programming via practice.

so let us Start Programming.

1. Simple Program. Hello World 


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

this is Simple Program where we print hello world.

2. Size of Function 


#include<conio.h>
#include<stdio.h>
main()
{
   
      printf("Integer occupies %d bytes",sizeof(int));
      printf("\n");
      printf("float occupies %d bytes",sizeof(float));
      printf("\n");
      printf("char occupies %d bytes",sizeof(char));
   
   
      getch();}

3. Arithmetic Operator 

How Arithmetic Operators Work in below Code.


#include<conio.h>
#include<stdio.h>
main()
{
      //implementation of arithmatic operators
      
      int x,y;
      
      printf("Enter first value:");scanf("%d",&x);
      printf("Enter second value:");scanf("%d",&y);
      
      printf("\n\n");
      printf("\nSum = %d",x+y);
      printf("\nDiff = %d",x-y);
      printf("\nProduct = %d",x*y);
      printf("\nDivision = %d",x/y);
      
      
      getch();}

4. Format Specifier in print function

#include<conio.h>
#include<stdio.h>
main()
{
      //use of %d - Format Specifier in printf function
   
      int x,y;
   
      printf("Enter first value:");scanf("%d",&x);
      printf("Enter second value:");scanf("%d",&y);
   
      printf("\n\n");
      printf("\n %d + %d = %d",x,y,x+y);
      printf("\n %d - %d = %d",x,y,x-y);
      printf("\n %d * %d = %d",x,y,x*y);
      printf("\n %d / %d = %d",x,y,x/y);
   
   
      getch();} 

5. Odd-Even identification, use of modulus % operator with an if-else structure 


#include<conio.h>
#include<stdio.h>
main()
{
      //Odd - Even identification, use of modulus % operator with if-else structure
   
      int num;
   
      printf("Enter Number:");scanf("%d",&num);
   
      if(num%2 == 0)
      printf("%d is even number",num);
      else
      printf("%d is odd number",num);

   
   
      getch();}

No comments: