Wednesday, 17 September 2014

Write a program to convert temperature farenheit into celcius.

SOURCE CODE

#include<stdio.h>
#include<conio.h>
void main()
{
    float c, f,i ;
   printf("CONVERTING FARENHEIT INTO CELCIUS\n\n") ;
   printf("Enter temperature in Farenheit : ") ;
   scanf("%f\a", &f) ;
   c=(f-32)*5/9 ;
   printf("\n\The temperature in celcius is : %f" , c ) ;
   for(i=0 ; i<10 ; i++)
   {
       printf("\a") ;
   } 
   getch() ;
}


SCREENSHOT

 

Saturday, 30 August 2014

Write a program to find the area of a circle.

SOURCE CODE

//WAP to find the area of the circle.

#include<stdio.h>
#include<conio.h>
void main()
{
    float r, area ;
    printf("AREA OF CIRCLE\n\n") ;
   printf("Enter the radius of the circle : ") ;
   scanf("%f", &r) ;
   area=3.14*(r*r) ;
   printf("\n\nThe area of the square is : %f", area) ;
   getch() ;
}


SCREENSHOT


Write a program to find the area of a square.

SOURCE CODE

//WAP to find the area of the square.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, area ;
    printf("AREA OF SQUARE\n\n") ;
   printf("Enter the side of the square : ") ;
   scanf("%d", &a) ;
   area=a*a ;
   printf("\n\nThe area of the square is : %d", area) ;
   getch() ;
}


SCREENSHOT


Write a program to find the area of a rectangle.

SOURCE CODE

//WAP to find the area of the rectangle.

#include<stdio.h>
#include<conio.h>
void main()
{
    int l, b, area ;
    printf("AREA OF RECTANGLE\n\n") ;
   printf("Enter the length : ") ;
   scanf("%d", &l) ;
   printf("Enter the breadth : ") ;
   scanf("%d", &b) ;
   area=l*b ;
   printf("\n\nThe area of the rectangle is : %d", area) ;
   getch() ;
}


SCREENSHOT


Thursday, 28 August 2014

Write a program to make a simple calculator taking input of two numbers.

SOURCE CODE

//WAP to make a simple calculator taking input of two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, sum, sub, mul, mod ;
   float div ;
   printf("SIMPLE CALCULATOR\n\n") ;
   printf("Enter the value of A : ") ;
   scanf("%d", &a) ;
   printf("Enter the value of b : ") ;
   scanf("%d", &b) ;
   sum=a+b ;
   sub=a-b ;
   mul=a*b ;
   div=a/b ;
   mod=a%b ;
   printf("\nThe addition is %d.", sum) ;
   printf("\nThe substraction is %d.", sub) ;
   printf("\nThe multiplication is %d.", mul) ;
   printf("\nThe division is %f.", div) ;
   printf("\nThe modulus is %d.", mod) ;
   getch() ;
}


SCREENSHOT


Write a program to substract two numbers.

SOURCE CODE

//WAP to substract two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, sub ;
   printf("SUBSTRACT TWO NUMBERS\n\n") ;
   printf("Enter the value of A : ") ;
   scanf("%d", &a) ;
   printf("Enter the value of b : ") ;
   scanf("%d", &b) ;
   sub=a-b ;
   printf("\nThe substraction of %d and %d is %d.", a,b,sub) ;
   getch() ;
}


SCREENSHOT



NOTE : You can do multiplication, division and modulus simply replace the minus operator with *, / or % respectively from the process part. For more help go to the calculator program.

Write a program to add two numbers.

SOURCE CODE

//WAP to add two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, sum ;
   printf("ADD TWO NUMBERS\n\n") ;
   printf("Enter the value of A : ") ;
   scanf("%d", &a) ;
   printf("Enter the value of b : ") ;
   scanf("%d", &b) ;
   sum=a+b ;
   printf("\nThe sum of %d and %d is %d.", a,b,sum) ;
   getch() ;
}


SCREENSHOT