Showing posts with label C PROGRAMS. Show all posts
Showing posts with label C PROGRAMS. Show all posts

A Short Trick For Calculate Area in C

CALCULATE AREA IN C:-

Here is short method to calculate the area of triangle,rectangle and other more as the following 
programming steps.


1.WAP TO CALCULATE THE ARE OF CIRCLE.

A shorcut to learn C language

WAP TO CALCULATE SIMPLE INTEREST :-
It is the short and simple method to calculate the simple interest ,here clrscr(); is used for to clear the screen and getch(); is used for to hold the out on the screen.



A SHORTCUT TO PRINT ARITHMETIC OPERATION

We can easy perform the arithmetic operation without using third variable as the following 

#include<stdio.h>
void main()
{
int a,b;
float div;
clrscr();

printf("enter the value of a=");

scanf("%d",&a);

printf("enter the value of b=");

scanf("%d",&b);

printf("\tsum=\t%d\n",a+b);//Addition Operation 

printf("\tsub=\t%d\n",a-b); // Subtraction Operation 

printf("\tmul=\t%d\n",a*b); //Multiplication Operation

printf("\tdiv=\t%f\n",a/b);  //Division Operation

getch();

}

O/P:-enter the value of a=6
        enter the value of b=2
       
      sum=8   
      sub=4    
      mul=12    

      div=3.0

A shortcut to learn the computer programming

WAP TO PERFORM ARITHMETIC OPERATION
We are providing the simple way to perform the arithmetic operation in easy and simple manner.In this program ,we are  also using the type conversion.

#include<stdio.h>
void main()
{
int a,b,sum,sub,mul;
float div;
clrscr();
printf("enter the value of a=");
scanf("%d",&a);
printf("enter the value of b=");
scanf("%d",&b);
sum=a+b;
printf("\tsum=\t%d\n",sum);
sub=a-b;
printf("\tsub=\t%d\n",sub);
mul=a*b;
printf("\tmul=\t%d\n",mul);
div=(float)a/b; //Type conversion
printf("\tdiv=\t%f\n",div);

getch();
}
O/P:-enter the value of a=6
     enter the value of b=2
     sum=8    sub=4     mul=12   div=3.0

How to learn C language in easy way

WAP TO PRINT SUM OPERATION WITHOUT USING THIRD VARIABLE

#include<stdio.h>
void main()
{
int a,b;
clrscr();
printf("enter the value of a=");
scanf("%d",&a);
printf("enter the value of b=");
scanf("%d",&b);
printf("SUM=%d",a+b); // Sum operation without using third variable
getch();
}
o/P:- enter the value of a= 4
      enter the value of b= 6
       
      SUM is = 10

How to learn C language in easy way


WAP to insert and print integer no., float no. and character.


#include<stdio.h>
void main()
{
int a,b;
float c,d;
clrscr();
printf("enter the value of integer a=");
scanf("%d",&a);
printf("enter the value of integer b=");
scanf("%d",&b);
printf("enter the value of float c=");
scanf("%f",&c);
printf("enter the value of float d=");
scanf("%f",&d);
printf("a=%d\tb=%d\tc=%f\td=%f",a,b,c,d);
getch();
}
O/P:- Enter the value of integer a=4
         Enter the value of  integer b =5
        Enter the value of float c = 4.5
        Enter the value of float d= 7.4
   
       a=4        b=5        c=4.5       d=7.4
     

         

How to learn C language in easy way

WAP to print "Your Details.
#include<stdio.h>
void main()
{
clrscr();
printf("\"MY NAME IS SAHIL\"\nAGE- 24 YEAR\tSEX-MALE\nPHONE NO.-123456789");
}

O/P:- MY NAME IS SAHIL
        AGE-24 YEAR 
        SEX-MALE
        PHONE NO.-123456789


BACK                                                          NEXT

How to learn C language in easy way



WAP TO PRINT “HELLO”
 #include<stdio.h> //Header file(standard input output )
main()   // Main function
{
printf("HELLO");
return 0;
}

Output:-Hello


                                                                                                                          NEXT