Download as pdf or txt
Download as pdf or txt
You are on page 1of 63

Ex:No: Roll No:

Date:

Finding the Total and average


of three numbers

AIM:

To draw the flowchart for implementing the total and average of three
numbers using raptor tool.

ALGORITHM:

Step:1 Start

Step:2 Read a,b,c

Step:3 t=a+b+c

Step:4 av=t/3

Step:5 print t(total),av(average)

Step:6 Stop
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION :

In this flowchart , we got the input as the variables called a,b,c and
via using the variable t , we do the arthimatic operation such as addition . After
we done the operation , the value which was stored in the variable t, got divided
by number 3 , because the task is determained as sum and average of three
numbers . For perform the average arthimatic operation , let we introduce the
variable named “av” . with the help of the variable called “av” , in order to print
the average of the three numbers. In this flow chart we have used seven symbols
for evaluating total and average of the numbers . if we include start and stop
symbols , we got overall 9 symbols.

RESULT:

Thus the flowchart for finding total and average of three numbers is
implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Calculation of Simple interest and compound


Interest

AIM:

To draw the flowchart for implementing the calculation of simple interest and
compound interest using raptor tool.

ALGORITHM:

Step:1 Start

Step:2 Read p,n,r from the user

Step:3 si=p*n*r/100

Step:4 ci=p*(1+r)^t-p

Step:5 Print si,ci

Step:6 Stop
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION :

First of all , the flowchart is drawn for calculating the simple


interest and compound interest . At first we got principle amount in variable of
‘p’ and as like we got the other inputs in their respective variables. In the task
we are in order of calculating the simple interest and compound interest , for
that they have specific formulae , by utilizing the formulae we got output. For
printing output of the flowchart , we introduced two more variables. In real
world examples , given rate = 6, time = 6 and principle amount =1000 . Finally
the output is 360 and compound interest is in floating value such as 418.5191.

RESULT:

Thus the flowchart for calculating simple interest and compound


interest is implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Area and perimeter of different shapes


AIM:

To draw the flowchart for implementing the calculation of area and perimeter of
different shapes using raptor tool.

ALGORITHM:

STEP 1: Start

STEP 2: Display the choices of different shapes to the user.

STEP 3: Assign a variable to get the choice of shape from the user.

STEP 4: If the choice is, get the dimensions required for square.

STEP 5: Find the perimeter and area of a square and assign it to a variable perimeter and
area.

STEP 6: Print the perimeter and area of the square.

STEP 7: If the choice is 2, get the dimensions required for rectangle.

STEP 8: Find the perimeter and area of a rectangle and assign it to a variable perimeter and
area.

STEP 9: Print the perimeter and area of the rectangle.

STEP 10: If the choice is 3, get the dimensions required for circle.

STEP 11: Find the perimeter and area of a circle and assign it to a variable perimeter and area

STEP 12: Print the perimeter and area of the circle.

STEP 13:If the choice is 4, get the dimensions required for triangle.

STEP 14: Find the perimeter and area of a triangle and assign it to a variable perimeter and
area.

STEP 15: Print the perimeter and area of the triangle.

STEP 16: If the choice is 5, get the dimensions required for parallelogram.

STEP 17: Find the perimeter and area of a parallelogram and assign it to a variable perimeter

and area.

STEP 18: Print the perimeter and area of the parallelogram.


Ex:No: Roll No:

Date:

STEP 19: Stop.

FLOWCHART:
Ex:No: Roll No:

Date:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION :

The flowchart is made for calculating the area and perimeter of the
given shape , the shape may be circle or square or rectangle and etc,. In this task
we want to determine the formulae for the different shapes . The calculating the
values for different shapes we used separate formulae and separate selection
symbols . while designing the flowchart , first we want to get the what is the
shape from the user and we do the operation as seperate for shapes and finally
print the area for each shapes. For example the given inputs are 30 and 6 and
then it shows or print the output such as perimeter is 22 and area is 30. This is
the way we calculated area and perimeter of five different shapes.

RESULT:

Thus the flowchart for calculating area and perimeter of different shapes is
implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Conversion of temperature from Celsius to


Fahrenheit and from Fahrenheit to Celsius
AIM:

To draw the flowchart for implementing the calculation of area and perimeter of
different shapes using raptor tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the UNIT from user.

STEP 3: If unit==C Assign f=((9*c)/5)+32.

STEP 4: Print the temperature in f.

STEP 5: else Assign cel=(f-32)*1.8.

STEP 6: Print the temperature in cel.

STEP 7: Stop.
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
This flowchart shows the conversion of temperature called from
Celsius to Fahrenheit and from Fahrenheit to Celsius . For this we had a
mathematical formula for both the conversion , we just use this formula in the
assignment box and we calculated very easily. Before doing the operation we
want to get the input from the user as what does he/she want to convert either
from Celsius to Fahrenheit and from Fahrenheit to Celsius . we also want to get
another input such as some value what he/she want to convert. At Last , we had
print that function as convenient for user.

RESULT:

Thus the flowchart for conversion of temperature in celsius to fahrenheit and


fahrenheit to celsius is implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Biggest of three numbers


AIM:

To draw the flowchart for implementing the biggest of three numbers using raptor
tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of three numbers a, b, c from the user.

STEP 3: Find if a is bigger than b and c using selection structure .

STEP 4: If yes ,Print a as the biggest of the three numbers.

STEP 5: If not, find if b is bigger than c .

STEP 6: If yes ,Print b as the biggest of the three numbers.

STEP 7: If not ,Print c as the biggest of the three numbers.

STEP 8: Stop.
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
It is one of the simplest task and so the flowchart is not big . For
finding the biggest number of 3 numbers , first we want to compare the first two
inputs , before this we want use the input function to get the inputs such as a ,b
, c . After comparing the first two input, and then compare third input with the
result of the first two input. Finally the output is produced, which is a largest
number of given number which was the input given from the user . Here no
need to declare the even one variable, because it is not necessary for this task.

RESULT:

Thus the flowchart for finding the biggest of three numbers is implemented using
raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Roots of the Quadratic Equation


AIM:

To draw the flowchart for implementing the roots of a quadratic equation using
raptor tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of coefficient of x2 (a), coefficient of x(b) and constant(c) from
the user

STEP 3: Assign RQ1=0,RQ2=0;num1=0;num2=0;

STEP 4: num1=-b+((b^2-4*a*c)^1/2)

STEP 5: num2=-b-((b^2-4*a*c)^1/2)

STEP 6: RQ1=NUM1/2*a

STEP 7: RQ2=NUM2/2*a

STEP 8: Print RQ1, RQ2.

STEP 9: stop
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION

In this flowchart we in order to find the roots of a quadratic equation. Getting


three variables a b and c from the user , where a is the coefficient of x^ 2 and b
is the coefficient of x and c is the constant term which was given from the user .
By Assigning D , which is the formula of the quadratic equation , is the formula
used for the done the operation. Selection process is also involved in this task.
From this we can calculate the roots of the quadratic equation . finally print the
desired output by using RQ1 and RQ2.

RESULT:

Thus the flowchart for finding the roots of the quadratic equation is
implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Exchanging the values of two variables

AIM:

To draw the flowchart for implementing the exchange of values in two variables
using raptor tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of two numbers A and B from the user.

STEP 3: Assign temporary variable(temp).

STEP 4: Assign temp=A.

STEP 5: Assign A=B.

STEP 6: Assign b=temp.

STEP 7: Print the swapped numbers A and B.

STEP 8: Stop
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION
The flowchart is made for implementing the exchange of values in two variables
using raptor . Firstly declaring the two input variable a and b and get it from the
user as a input . Assign the temporary variable as wish you want and the next
step is to assign a is equal to b, also assign temporary variable is b .Finally
display the value of a and b which was swapped one by using temporary
variable. For example we used a=4 and b=5 , and the output is a=5 and b=4.

RESULT:

Thus the flowchart for exchanging the values in two variables is


implemented using raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Counting of Numbers

AIM:

To draw the flowchart for implementing the counting of numbers


using raptor tool.

ALGORITHM:

STEP 1: Start

STEP 2: Assign I=1

STEP 3: Check i==11 into looping statement. if no print I . add I


values.

STEP 4: if yes ,end the loop.

STEP 5: Stop
Ex:No: Roll No:

Date:

FLOWCHART:
Ex:No: Roll No:

Date:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION :

This flowchart is made for counting the numbers as which was given from the
user. We want to choose the array because we want to store n numbers and get
size of the array . Use the loop and assign the value to each index position.
Again get the value of another number from the user and check that number is
located in each index element and if true assign one temporary variable and add
1 in temporary variable if not temporary value is 0.

RESULT:

Thus the flowchart for counting of numbers is implemented using


raptor tool and output is verified successfully.
Ex:No: Roll No:

Date:

Summation of numbers

AIM:

To draw the flowchart for implementing the summation of numbers using raptor
tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of range of summation(N) from user.

STEP 3: Assign sum=(N*(N+1))/2.

STEP 4: Print the summation of the numbers.

STEP 5: Stop
Ex:No: Roll No:

Date:

FLOWCHART:
Ex:No: Roll No:

Date:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
This flowchart is made for complete the task , the task is finding
the summation for N numbers and to print the summation of the numbers . First
we want add the values which was given from the user, before sum here assign
to the value of is as 0 were array of 1 'i' is 10. Then again assign the s value that
is equal to 1. Also they have to assign the t value as 0. Then they get input and
check the condition if the condition is satisfied it works under true condition.
other wise, it works under the false condition and ends the program by printing
the desired output.

RESULT:

Thus the flowchart for summation of numbers is implemented using raptor tool and
output is verified successfully.
Ex:No: Roll No:

Date:

Factorial computation

AIM:

To draw the flowchart for implementing the computation of factorial using raptor
tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of the number for which factorial has to be found from the user(n).

STEP 3: Assign factorial=1.

STEP 4: Start a loop for n==0

STEP 5: Assign factorial=factorial*x with the loop.

STEP 6: Assign n=n-1

STEP 7: Print the factorial of the number.

STEP 8: Stop
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
First of all , the flowchart is made for computing the
factorial of the given inputs which was given from the user. At starting , declare
the variable called n and give or assign it as 0 . And then introduce the variable
called factorial for done the task . Declare the end value of the loop as factorial
number. Multiply the given number with temporary variable and store it in
temporary variable for each time until Loop get terminated. At last , Print the
factorial of the number.

RESULT:

Thus the flowchart for Factorial computation is implemented using raptor


tool and output is verified successfully.
Ex:No: Roll No:

Date:

Generation of Fibonocci Series


AIM:

To draw the flowchart for implementing the computation of factorial using raptor
tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input of the range required by the user(m).

STEP 3: Assign a=0. b=1.

STEP 4: Assign b=1.

STEP 5: Assign i=3.

STEP 6: Print the value of ‘a’.

STEP 7: Print the value of ‘b’.

STEP 8: Start the loop such for n==i

STEP 9: Assign fib=a + b within the loop.

STEP 10: Print the value of ‘ fib’ .

STEP 11: Assign a=b.

STEP 12: Assign b=fib. i=i+1 within the loop.

STEP 13: STOP


Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
This flowchart shows the implementation of the computation
of factorial using raptor tool. First of all we want to declare the variables called
f1 which is equal to the -1 and f2 is equal to the 1 . After get the values you
want . Declare the temporary variable you want and to store the value of sum of
F1 and F2 such as t. Assign F2 to F1 and t to F2 and then do the increment and
print the output each time and that will continue the process until the condition
fails and print the output of the flowchart.

RESULT:

Thus the flowchart for fibonocci series is implemented using raptor tool
and the output is verified successfully.
Ex:No: Roll No:

Date:

Summation series

AIM:

To draw the flowchart for implementing the computation of factorial using raptor
tool.

ALGORITHM:

STEP 1: Start

STEP 2: Get the input from the user to print their summation.

STEP 3: Assign sum=0.

STEP 4: Start a loop and n==0

STEP 5: Assign sum=sum +n

STEP 6: Print the value of sum.

STEP 7: Assign n=n-1

STEP 8: Stop.
Ex:No: Roll No:

Date:

FLOWCHART:

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
This flowchart shows the summation (addition) of the N
numbers . At first , declare the variable as your wise and get the input as which
he/she (user) want to sum and print the output. And also get the another
variable which is used to terminate the loop. use the condition of I is greater
than and equal to the n , based on this condition number of values to be added .
use the increment in the loop , made the loop as finite . At last , print the desired
output .

RESULT:

Thus the flowchart for summation series is implemented using raptor tool
and the output is verified successfully.
Ex:No: Roll No:

Date:

Finding the Sum and Average of three numbers

AIM:

To write and execute a c program for finding the sum and average of three numbers.

ALGORITHM:

Step:1 Start the program

Step:2 Read the three numbers from the user

Step:3 Add the three numbers and store it in sum.

Step:4 Find the average of three numbers ans store it in average.

Step:5 Display the sum and average.

Step:6 Stop the program.

CODING:

#include<stdio.h>

int main()

float a,b,c,sum,avg;

printf("ENTER THE THREE NUMBERES :\t");

scanf("%f%f%f",&a,&b,&c);

sum=a+b+c;

printf("THE SUM OF THREE NUMBERS %f\n",sum);

avg=sum/3;

printf("THE AVERAGE OF THREE NUMBERS IS %f:\n",avg);

return 0;

}
Ex:No: Roll No:

Date:

OUTPUT :

DISCUSSION :

First of all, declare the header file for using input and output
functions. For this program use the variables a, b, c, sum, avg belongs to the
data type float. Because of the average function. Then print the inputs a, b, c in
order to get the input from the user and use the scanf() function to get a, b, c
from user. And add the three values which will store in sum and print sum. To
get average divide the sum by 3 and store that in avg variable. To display the
result of the task, print the average of three numbers.

RESULT:

Thus the program for finding the sum and average of three numbers
is implemented and output is verified successfully.
Ex:No: Roll No:

Date:

Calculation of Simple Interest and Compound


Interest

AIM:

To write and execute a c program for calculating simple interest and compound interest.

ALGORITHM:

Step:1 Start the program

Step:2 Read the principal amount,rate of interest and number of years from the user.

Step:3 Calculate the simple interest.

Step:4 Read the number of times interest applied and time period from the user.

Step:5 Calculate the Compound interest.

Step:6 Display the simple interest and compound interest.

Step:7 Stop the program.

SOURCE CODE :

#include<stdio.h>

#include<math.h>

int main()

float p,n,r,si,ci,t,no;

printf("ENTER THE PRINCIPLE,NO.OF YEARS,RATE OF INTEREST\n");

scanf("%f%f%f",&p,&n,&r);

si=p*n*r;

printf("\nNUMBER OF TIMES INTERST APPLIED AND TIME PERIOD:\n");

scanf("%f%f",&no,&t);
Ex:No: Roll No:

Date:

ci=(p*pow((1+r/no),no*t));

printf("\nTHE SIMPLE INTEREST IS :%f",si);

printf("\nTHE COMPOUND INTEREST :%f",ci);

return 0;}

OUTPUT:
Ex:No: Roll No:

Date:

DISCUSSION:
The coding is to calculate the compound and simple interest. First,
we want to declare the variables you want in float data type and here we have
used float function “%f” because of float values contain in simple interest and
compound interest. Using the mathematical formula called si=p*r*n and assign
the values, process using the input and after processing, store the values in the
another variable , and print the variables using float() function .

RESULT:

Thus the program for calculating the simple interest and compound
interest is implemented and output is verified successfully.
Ex:No: Roll No:

Date:

Finding the Area and Perimeter of Square


AIM:

To write and execute a c program for finding the are and perimeter of a square.

ALGORITHM:

Step:1 Start the program

Step:2 Read the side of the square from the user.

Step:3 Calculate the area and perimeter of square.

Step:4 Display the area and perimeter of square.

Step:5 Stop the program.

SOURCE CODE :

#include<stdio.h>

#include<math.h>

int main()

float a,area,perimeter;

printf("ENTER THE VALUE OF A :\n");

scanf("%f",&a);

area=pow(a,2);

perimeter=4*a;

printf("\nTHE AREA OF THE SQUARE : %f",area);

printf("\nTHE PERIMETER OF THE SQUARE : %f",perimeter);

return 0;

}
Ex:No: Roll No:

Date:

OUTPUT :

DISCUSSION:
Here in this program, our task is to find the area and the perimeter of the square.
float function is used because area and perimeter may be in float data type.
“scan %f” is used because we in order of using float function. Then get the
value of “a” from the input and multiple twice or do the power function, we get
area and by multiplying the value of a with 4 will get the perimeter then print
the desired output .you will get the exact output using this coding because of the
float function.

RESULT:

Thus the program for finding the area and perimeter of a square is
implemented and output is verified successfully.
Ex:No: Roll No:

Date:

Conversion of Temperature in Celsius to Fahrenheit


and Fahrenheit to Celsius
AIM:

To write and execute a c program for conversion of temperature from celsius to


Fahrenheit and from Fahrenheit to Celsius.

ALGORITHM 1:

Step:1 Start the program

Step:2 Read the temperature in celsius.

Step:3 Convert the celsius to fahrenheit.

Step:4 Display the temperature in fahrenheit.

Step:5 Stop the program.

ALGORITHM 2:

Step:1 Start the program

Step:2 Read the temperature in fahrenheit.

Step:3 Convert the fahrenheit to celsius.

Step:4 Display the temperature in celsius.

Step:5 Stop the program.

CODING 1:

#include<stdio.h>

#include<math.h>

int main()

float c,f;
Ex:No: Roll No:

Date:

printf("ENTER THE TEMPERATURE IN CELSIUS:\n");

scanf("%f",&c);

f=c*9/5+(32);

printf("THE TEMPERATURE IN FARENHEIT :%f",f);

return 0;

CODING 2:

#include<stdio.h>

int main()

float c,f;

printf("ENTER THE TEMPERATURE IN FARENHEIT :\n");

scanf("%f",&f);

c=(f-32)*5/9;

printf("THE TEMPERATURE IN CELCUIS :%f",c);

return 0;

OUTPUT 1 :
Ex:No: Roll No:

Date:

OUTPUT 2 :

DISCUSSION :
Here the coding is to convert the given temperature to
Celsius and as well as Fahrenheit to Celsius. Here we used float function
because we are in order of handling input with the temperature. Hereby, first
enter the temperature in Fahrenheit and convert it into Celsius using the
mathematical formula and also there is the function for converting the Celsius to
the Fahrenheit , just change/reverses the formula and print the desired output if
input in Fahrenheit, convert it to Celsius and in the same way convert Celsius to
Fahrenheit if it is on Celsius.

RESULT:

Thus, the program for conversion of temperature in Celsius to


Fahrenheit and Fahrenheit to Celsius is implemented and output is verified
successfully.
Ex:No: Roll No:

Date:

Biggest of Three numbers

AIM:

To write and execute a c program for finding the biggest of three numbers.

ALGORITHM :

Step:1 Start the program

Step:2 Read the three numbers from the user.

Step:3 If the value of a is greater than b and c then print a is biggest otherwise goto step 4.

Step:4 If the value of b is greater than a and c then print b is biggest otherwise print c is
biggest.

Step:5 Stop the program.

CODING:

#include <stdio.h>

int main()

int a,b,c;

printf("ENTER THE THREE NUMBERS :");

scanf("%d%d%d",&a,&b,&c);

if((a>b)&&(a>c))

printf("A IS GREATER OF THREE NUMBERS %d \t",a);

else

if((b>a)&&(b>c))

printf("B IS GREATER OF THRE NUMBERS %d \t",b);

if((c>a)&&(c>b))
Ex:No: Roll No:

Date:

printf("C IS GREATER OF THREE NUMBERS %d \t",c);

return 0;

OUTPUT :
Ex:No: Roll No:

Date:

DISCUSSION :

The coding is to find the greatest number among the given three
values. For that first get any three numbers from the user and store it on a
variables, use the selection if it satisfies the If the condition that is mentioned
above then it must print the output as "a is the greater value among us".
otherwise, the condition fails it check the else condition then if it`s true it print
"b is greater" otherwise print it "c is greater" and end execute the required
output.

RESULT:

Thus the program for finding the biggest of three numbers is implemented and
output is verified successfully.
Ex:No: Roll No:

Date:

Finding the Roots of the Quadratic Equation


AIM:

To write and execute a c program for finding the roots of a quadratic equation.

ALGORITHM :

Step:1 Start the program

Step:2 Read the three coefficient values of a quadratic equation from the user.

Step:3 Calculate the value of the d using the formula.

Step:4 If the value of d is equal to 0, then print roots are real and equal, otherwise if d>0 then
print roots are real and unequal and if d<0 then print roots are imaginary.

Step:5 Stop the program.

CODING:

#include<stdio.h>

#include<stdlib.h>

#include<math.h>

int main()

int a,b,c,d;

float x,y,z,u,v;

printf("ENTER THE THREE NUMBERS :");

scanf("%d%d%d",&a,&b,&c);

d=(pow(b,2)-4*a*c);

if(d==0)

printf("\nTHE ROOTS ARE REAL AND EQUAL");

x=-b/(2*a);
Ex:No: Roll No:

Date:

printf("\nTHE ROOT IS %f",x);

else

if(d>0)

printf("\nTHE ROOTS ARE REAL AND UNEQUAL");

y=(-b+sqrt(d))/(2*a);

z=(-b-sqrt(d))/(2*a);

printf("\nTHE FIRST ROOT IS %f",y);

printf("\nTHE SECOND ROOT IS %f",z);

else

{ printf("\nTHE ROOTS ARE IMAGINARY");

u=-b/(2*a);

v=sqrt(abs(d));

printf("\nTHE real IS %f",u);

printf("\nTHE imaginary IS %f",v);

return 0;

}
Ex:No: Roll No:

Date:

OUTPUT :
Ex:No: Roll No:

Date:

DISCUSSION:

This program is used for finding the roots of a quadratic


equation. First, We declare integers a, b, c, d and floating variable such as x, y,
z, u, v. We get the values of a, b, c from the user and then declare d is equal to
expression called b²-4ac. By if else statement, if d is zero It will print the roots
are real and equal. Then declaring the x(float)=b/2a. It will print the value of
root that is x. If d is not equal to zero if execute the else statement that is d is
greater than zero. In first line it will print the roots are real and unequal and
declare y is equal to (-b-sqrt(d))/2a and x is equal to (-b + sqrt (d))/2a. It will
print the first root as y and second root as x. If d is lesser than zero, else : The
roots are imaginary and we declare u equal to b/2a and v equal to sqrt (abs(d))
and printing the value of u and v .

RESULT:

Thus the program for finding the roots of a quadratic equation is


implemented and output is verified successfully.
Ex:No: Roll No:

Date:

Swapping of Two numbers


AIM:

To write and execute a c program for finding the roots of a quadratic equation.

ALGORITHM :(With temporary variable)

Step:1 Start the program

Step:2 Read the two values from the user.

Step:3 Assign the first value to temporary variable, second value to first value and temporary
variable to first value.

Step:4 Then Display the two values.

Step:5 Stop the program.

ALGORITHM :(Without temporary variable)

Step:1 Start the program

Step:2 Read the two values from the user.

Step:3 Add the two values and assign to first variable, then subtract the b value from a and
assign it to second variable,subtract the b value from a and assign it to first variable.

Step:4 Display the two values.

Step:5 Stop the program.

CODING:

With Temporary variable

#include <stdio.h>

int main()

int temp,a,b;

printf("ENTER THE VALUE OF A :");


Ex:No: Roll No:

Date:

scanf("%d",&a);

printf("\nENTER THE VALUE OF B :");

scanf("%d",&b);

temp=a;

a=b;

b=temp;

printf("\nTHE VALUE OF A AFTER SWAPING : %d",a);

printf("\nTHE VALUE OF B AFTER SWAPING : %d",b);

return 0;

Without temporary Variable :

#include <stdio.h>

int main()

int a,b;

printf("ENTER THE VALUE OF A :");

scanf("%d",&a);

printf("\nENTER THE VALUE OF B :");

scanf("%d",&b);

a=a+b;

b=a-b;

a=a-b;

printf("\nTHE VALUE OF A AFTER SWAPING :%d",a);

printf("\nTHE VALUE OF B AFTER SWAPING :%d",b);

return 0;}
Ex:No: Roll No:

Date:

OUTPUT :
Ex:No: Roll No:

Date:

DISCUSSION:
The program is to perform swapping of the two numbers by
using temporary variable. Here we discussed about two problems that is using
temporary variable that is with and without temporary variable. There is not a
big difference between the both. First, program we used the variable which is
“temp” which will denote the value is temporary, we can easily swap them.
whereas 2nd problem does not contain anything. the process under goes by the
mathematical operations such as addition and subtraction. By the way we got
swapped input and print the output.

RESULT:

Thus, the program for swapping of two values is implemented and


output is verified successfully.
Ex:No: Roll No:

Date:

Conversion of Amount in Rupees to Paise


AIM:

To write and execute a c program for conversion of rupees to paise.

ALGORITHM :

Step:1 Start the program

Step:2 Read the amount in rupees from the user.

Step:3 Convert the amount in rupees to paise.

Step:4 Then Display the amount in paise.

Step:5 Stop the program.

CODING:

#include <stdio.h>

int main()

int a,b;

printf("ENTER THE RUPEES :");

scanf("%d",&a);

b=a*100;

printf("\nTHE AMOUNT IN PAISE : %d",b);

return 0;

}
Ex:No: Roll No:

Date:

OUTPUT :
Ex:No: Roll No:

Date:

DISCUSSION:

This program is used to convert the amount in Rupees to


Paise. As usual we use the header file called <studio.h> function for input and
output functions. Here the int value is a, b were b is the assigned value that
stores the value of rupees and that was enter by the user as an input. here scanf()
function is used to allow to accept the input in standard, and then with help of
the mathematical operations we got the output which will be displayed.

RESULT:

Thus, the program for conversion of amount in rupees to paise is


implemented and output is verified successfully.

You might also like