Wednesday, 3 May 2017

Operators .

Operators in C:

Operators are sign which performs some operation on operands.

Categories of operators:

1.Unary
It takes single operand.

2.Binary
It takes two operands.

3.Ternary
It takes three operands.

4.Bitnary
It takes more than 3 operands.

Types of operators in C

1.Arithmetic operators

(- unary ,+,*,%,/ all binary)

2.Releational operators(binary)

(>,<,>=,<=,==,!=)
All relational operators compare 2 values and return boolean value.

3.Logical operators 

&& AND operator (binary)
        OR operator (binary)
!     NOT operator (unary)

4.Increment/Decrement operator 

++X or --x prefix 
X++or x--postfix

5.Assignment operator

=, +=, -=, /=, *=(shorthand assignment operator)

=  (Bitwise assign operator)

6.Conditional operators (Ternary)

?:

             

/*Program to display tables of all number between range*/

Program:

#include<studio.h>
#include<conio.h>
void main( )
{ int lb,ub,i;
clrscr( );
printf ("\n enter lb and ub");
scanf ("%d%d",&lb,&ub);
{
for(i=1;i<=10;i++)
{
printf ("%d",lb*i);
}
printf ("\n");
}
}

Program to check no is Armstrong or not.

#include<studio.h>
void main( )
{ int no,sum =0,r,x;
printf ("\n enter no ");
scanf("%d",&no);
x=no;
while (no>0)
{
r=no%10;
sm=sm+(r*r*r);
no=no/10;
}
if(sum==x)
{
printf("\n It is Armstrong no");
}
else
{printf(" not Armstrong no");
}

Computer language

Computer language is a way of communication between the user and computer.

1.Low level language:

Here, we can directly interact with hardware.
It does not require any compiler and is tough in Learning due to it's complex syntaxes.

Eg: Assembly language for CPU.
         Machine language.

2.Middle level language:

We can write programming of both low level as well as high Level language.

Eg: C and C++.

3.High level language:

It requires compiler to convert high level into low level language.
It is very easy in learning due to its easy syntaxes.

Eg: BASIC, COBOL, Fortran etc.


Tuesday, 2 May 2017

C language

Compiler

It is a software which converts high level Lang or the source code in low level Language i.e, machine code and this procedure is called compilation.

Program to display ASCII value of any character.

Program #include<studio.h> #include<condo.h> void main( ) { char ch; clrscr(); printf("\n enter any character...