Saturday, 30 August 2014
Write a program to find the area of a rectangle.
//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
//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.
//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
//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
Subscribe to:
Posts (Atom)