Programs Copy
Transcript of Programs Copy
-
8/13/2019 Programs Copy
1/86
PROGRAMS USING SIMPLE STATEMENTS AND EXPRESSIONS
EX: NO: 04 (a) PERFORM INTEGER TO FLOAT CONVERSION
FLOWCHART:
Start
Read integer
b=(float)a
Print value
Stop
-
8/13/2019 Programs Copy
2/86
-
8/13/2019 Programs Copy
3/86
EX: NO: 04 (b) MULTIPLICATION OF TWO NUMBERS
FLOWCHART:
Start
READ a, b
c=a*b;
Print c
Stop
-
8/13/2019 Programs Copy
4/86
RESULT:
Thus the c program to produce the Multiplication result of given two Numbers was written,entered, executed and the output was verified.
-
8/13/2019 Programs Copy
5/86
FLOWCHART:
Start
Read the marks
tot=m1+m2+m3+m4+m5; avg=tot/5;
Display avg
Stop
-
8/13/2019 Programs Copy
6/86
RESULT:
Thus the c program to calculate the Average of given five Numbers was written,entered, executed and the output was verified.
-
8/13/2019 Programs Copy
7/86
EX: NO: 04 (d) EVALUATION OF AN EQUATION
.
FLOWCHART:
Start
Read v,c,g,d
nr=(2*v)+(6.22*c*d); dr=g+v;r=nr/dr;
Print r
Stop
-
8/13/2019 Programs Copy
8/86
RESULT:
Thus the c program to evaluate the given Equation was written, entered, executed andthe output was verified.
-
8/13/2019 Programs Copy
9/86
EX: NO: 04 (e) PERFORM MEASUREMENT CONVERSION
FLOWCHART:
Start
Read millimeter
m=mm*1000;
Print mm
Stop
-
8/13/2019 Programs Copy
10/86
RESULT:
Thus the c program to convert given millimeter measurement into meter was written,
entered, executed and the output was verified.
-
8/13/2019 Programs Copy
11/86
SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING AND
LOOPING
EX: NO: 05 (a) CHECK ODD OR EVEN
FLOWCHART:
Start
Read n
rem=a%2
Isrem==0
Print even Print odd
Stop
-
8/13/2019 Programs Copy
12/86
RESULT:
Thus the c program to check whether given Number is odd or even was written, entered,executedand the output was verified.
-
8/13/2019 Programs Copy
13/86
EX: NO: 05 (b) FINDING BIGGEST OF 3NUMBERS
FLOWCHART:
Start
Read a,b,c
Big=x
yesIs y >big
Big=y
no
yesIs z>big
Big=z
Print big
Stop
-
8/13/2019 Programs Copy
14/86
RESULT:
Thus the c program to examine the biggest of given three numbers was written,entered,executed and the output was verified.
-
8/13/2019 Programs Copy
15/86
EX: NO: 05 (c) FIND THE SUM OF N NATURAL NUMBERS
FLOWCHART:
Start
READ n
I=1
NoIs
i
-
8/13/2019 Programs Copy
16/86
RESULT:
Thus the c program to find the sum of N natural numbers for given range was written,entered, executed and the output was verified.
-
8/13/2019 Programs Copy
17/86
EX: NO: 05 (d) FIND THE SUM OF DIGITS
FLOWCHART:
Start
READ n
Sum=0
Is
n>=0
yes
i=n%10;sum=sum+i;
n=n/10
Print sum
stop
-
8/13/2019 Programs Copy
18/86
RESULT:
Thus the c program to find the sum of digits for a given number was written, entered, executed
and the output was verified.
-
8/13/2019 Programs Copy
19/86
EX: NO: 05 (e) CHECK THE EVALUATION OF SINE SERIES
-
8/13/2019 Programs Copy
20/86
FLOWCHART:
sum=1
For i=1;i
-
8/13/2019 Programs Copy
21/86
RESULT:
Thus the c program to find the sum of digits for a given number was written, entered, executed
and the output was verified.
-
8/13/2019 Programs Copy
22/86
EX: NO: 05 (f) CREATION OF ARITHMETIC CALCULATOR
-
8/13/2019 Programs Copy
23/86
FLOWCHART:
Start
Read a,b
noIs n0
Read n
Switch n B
yes
Case 1 C=a+bno
Case 2 C=a-b
no
Case 3 C=a*b
no
Case 4 C=a/b
no
Case 0
A
B
Print invalid
Stop
PRINT C
Print c
Print c
Print c
-
8/13/2019 Programs Copy
24/86
RESULT:
Thus the menu driven c program to implement an Arithmetic Calculator was written, entered,executed and the output was verified.
-
8/13/2019 Programs Copy
25/86
EX: NO: 05 (g) TO CHECK PALINDROME
AIM:
FLOWCHART: start
Read num
Is
num!=0
Is
Rem=num%10a=
=rnu
Rnum=rnum*10+remm
num=num/10
Print plindrome Print not apalindrome
stop
-
8/13/2019 Programs Copy
26/86
RESULT:Thus the program to check the number is palindrome is verified and executed.
-
8/13/2019 Programs Copy
27/86
EX: NO: 05 (h) CHECK PRIME OR NOT
FLOWCHART:
start
Read num
i
-
8/13/2019 Programs Copy
28/86
stop
RESULT:Thus the program to check the number is prime is verified and executed.
-
8/13/2019 Programs Copy
29/86
EX: NO: 05 (i) CHECK ARMSTRONG OR NOT
FLOWCHART:
start
Read num
Is
num!=0
x=n%10;s=s+(x*x*x);n=n/10;
Is h==s
Print armstrong Print not a palindrome
stop
-
8/13/2019 Programs Copy
30/86
RESULT:Thus the program for checking the Armstrong number is verified and executed.
-
8/13/2019 Programs Copy
31/86
EX: NO: 05 (J) CONVERT BINARY TO DECIMAL
FLOWCHART:
start
Read bnum
while(b
num!=0
digit=bnum%10;decimal=decimal+(digit
-
8/13/2019 Programs Copy
32/86
=4
RESULT:Thus the program for convert the binary to decimal is verified and executed.
-
8/13/2019 Programs Copy
33/86
EX: NO: 05 (K) FIND THE FIBBONACCI SERIES
FLOWCHART:
start
Print num
Is num==0
For i=0;i
-
8/13/2019 Programs Copy
34/86
RESULT:Thus the program for convert to find the fibbonacci series is verified and executed.
-
8/13/2019 Programs Copy
35/86
EX: NO: 05 (L) FIND THE LEAP YEAR
FLOWCHART:
start
Read year
Is year%4
Is leap Not a
year Leap Year
stop
-
8/13/2019 Programs Copy
36/86
RESULT:Thus the program for convert to find the leap year is verified and executed.
-
8/13/2019 Programs Copy
37/86
SIMPLE PROGRAMMING FOR ONE DIMENSIONAL AND TWO
DIMENSIONAL ARRAYS
EX: NO: 06 (a) FIND THE SUM OF ARRAY ELEMENTS
FLOWCHART:start
Read n
I=0;I
-
8/13/2019 Programs Copy
38/86
The Sum of Array Elements is 280
RESULT:Thus the menu driven c program to find the sum of given array elements was written,entered, executed and the output was verified.
-
8/13/2019 Programs Copy
39/86
EX: NO: 06 (B) FIND MINIMUM AND MAXIMUM OF ARRAY ELEMENTSFLOWCHART:
start
Read cnt
I=0;I
-
8/13/2019 Programs Copy
40/86
RESULT:
Thus the c program to find the max and min of given array elements was written,entered, executed and the output was verified.
.
-
8/13/2019 Programs Copy
41/86
EX: NO: 06 (c) MULTIPLICATION OF 2*2 MATRIXES
-
8/13/2019 Programs Copy
42/86
D
FLOWCHART:
J=0
start Is
j
-
8/13/2019 Programs Copy
43/86
RESULT:
Thus the c program to perform 2*2 matrixes multiplication was written, entered, executedand the output was verified.
-
8/13/2019 Programs Copy
44/86
EX: NO: 06 (d) TRANSPOSE OF A MATRIX
FLOWCHART:
start
for(i=0;i
-
8/13/2019 Programs Copy
45/86
RESULT:
Thus the c program to perform transpose of a matrix was written, entered, executed andthe output was verified.
-
8/13/2019 Programs Copy
46/86
EX: NO: 06 (e) ADDITION OF 2*2 MATRIXES
-
8/13/2019 Programs Copy
47/86
FLOWCHART:D
J=0
start Isj
-
8/13/2019 Programs Copy
48/86
RESULT:
Thus the c program to perform 2*2 matrixes addition was written, entered, executed and theoutput was verified.
-
8/13/2019 Programs Copy
49/86
EX: NO: 07 SOLVING PROBLEMS USING STRINGFUNCTIONS
(a) STRING PALINDROME CHECKING
:
-
8/13/2019 Programs Copy
50/86
FLOWCHART:
start
Read string S
strcmp(s,
s1)==0
palindrome Not a palindrome
stop
-
8/13/2019 Programs Copy
51/86
RESULT:
Thus the c program to check whether the given string is palindrome or
not was written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
52/86
EX: NO: 07 (b) STRING CONCATENATION
FLOWCHART:
Start
Read strings S1,S2
strcat(S1,S2)
Print the string
Stop
-
8/13/2019 Programs Copy
53/86
RESULT:
Thus the c program to find the length of given two strings and concatenate
them was written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
54/86
Ex.No.7(c) STRING FUNCTIONS-COMPARE TWO
STRINGS
FLOWCHART:
start
Read s1,s2
Strcmp false
(s1,s2)
true
Print not equalPrint equal
stop
-
8/13/2019 Programs Copy
55/86
RESULT:
Thus the c program to compare two string using strcmp() function was written,
entered, executed and the output was verified.
-
8/13/2019 Programs Copy
56/86
Ex.No.7(d) STRING FUNCTIONS-COPY THE STRING
FLOWCHART:
Start
Read string Strcpy
strcpy(S2,S1)
Print the string S2
Stop
-
8/13/2019 Programs Copy
57/86
RESULT:
Thus the c program for copying two string using strcpy() function was written,entered, executed and the output was verified.
-
8/13/2019 Programs Copy
58/86
Ex.No.7(e) STRING CONVERSION TO
LOWERCASE,UPPERCASE,STRING LENGTH
-
8/13/2019 Programs Copy
59/86
FLOWCHART:
Start
Read the string
S1=strlwr(s)S2=strupr(s)S3=strrev(s)
N=strlen(s)
Print S1,S2,S3,N
Stop
-
8/13/2019 Programs Copy
60/86
RESULT:
Thus the c program for converting to lowercase,uppercase and finding string lengthwas written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
61/86
EX: NO: 08 PROGRAMS WITH USER DEFINED
FUNCTIONS
(a) FUNCTIONS WITHOUT ARGUMENTS & RETURN
TYPE
FLOWCHART:
start
Read year yr
yr%4==0
Leap year Not a leap year
stop
-
8/13/2019 Programs Copy
62/86
Thus the c program to check whether the given year is leap or not using
functions was written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
63/86
EX: NO: 08 (b) FUNCTIONSWITHOUTARGUM
ENTS &WITHRETURNTYPE
FLOWCHART:start
Read a,b,c
s=(a+b+c)/2
ar=sqrt(s*(s-a)*(s-b)*(s-c));
Print ar
stop
-
8/13/2019 Programs Copy
64/86
The Area of Triangle is 19.748418
RESULT:
Thus the c program to calculate the area of triangle using functions
was written, entered, executed and the output was verified
-
8/13/2019 Programs Copy
65/86
EX: NO: 08 (c) FUNCTIONS WITH ARGUMENTS & WITHOUT
RETURN TYPE
-
8/13/2019 Programs Copy
66/86
FLOWCHART:
start
Read element n
Read array element
a[i]>a[j]
T=a[i];
a[i]=a[j];
a[j]=t;
Print total no. of elements
Print array elements one by one
Print array elements befor e sorting
Print array elements after sorting
stop
-
8/13/2019 Programs Copy
67/86
-
8/13/2019 Programs Copy
68/86
RESULT:
Thus the c program to sort the given array of elements using functions was
written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
69/86
EX: NO: 08 (d)FUNCTIONS WITH ARGUMENTS & RETURN
TYPE
-
8/13/2019 Programs Copy
70/86
FLOWCHART:
start
Read element n
Read array element a[i]
s=a[i]
s=small(a,n)
Print smallest element of an array
stop
-
8/13/2019 Programs Copy
71/86
RESULT:
Thus the c program to find the smallest element of given array of elements
using functions was written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
72/86
EX: NO: 09 PROGRAM USING RECURSIVE
FUNCTION
(a) FACTORIAL OF A NUMBER
FLOWCHART:start
Read number n
n==0 || n==1
n*factorial(n-1) Return 1
Print factorial for the number
stop
-
8/13/2019 Programs Copy
73/86
-
8/13/2019 Programs Copy
74/86
EX: NO: 09 (b) SUM OF DIGITS
FLOWCHART:
start
Read number n
n
-
8/13/2019 Programs Copy
75/86
RESULT:
Thus the c program to find the sum of digits of a given number was
written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
76/86
EX.NO:9(c) RECURSIVE FUNCTIONS -FIBONACCI SERIES
FLOWCHART:start
Read Fibonacci series limit
Fib(n)
a=0
b=1
c=a+b;
a=b;
b=c;
Print Fibonacci series c
stop
-
8/13/2019 Programs Copy
77/86
RESULT:
Thus the c program to find the recursive function of a Fibonacci serieswas written,
entered, executed and the output was verified.
-
8/13/2019 Programs Copy
78/86
EX.NO:9(d) RECURSIVE
FUNCTION-TO REVERSE A
STRING
FLOWCHART:
start
Read string str
rev = getReverse(str);
*str
getReverse(str+1);
rev[i++] = *str;
Print reversed string rev
stop
-
8/13/2019 Programs Copy
79/86
RESULT:
Thus the c program to find the recursive function of reversing the given string waswritten, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
80/86
EX:NO:10 PROGRAM USING
STRUCTURES AND UNIONS
(a) STUDENT
RECORD
FLOWCHART:
start
Read rollno,name,dept and marksrno,,name ,dept, m1,m2,m3
s.avg=(s.m1+s.m2+s.m3)/3;
Print rollno,name,deot,marks and average marks
stop
-
8/13/2019 Programs Copy
81/86
RESULT:
Thus the c program to maintain the student record using structures was
written, entered, executed and the output was verified.
-
8/13/2019 Programs Copy
82/86
EX:NO: 10 (b) ARRAY OF
STRUCTURES
FLOWCHART:
start
Read rollno,name,dept,marks
rollno,name,marks,m1,m2,m3
s[i].rno==a
Print rollno,name,dept,marks
Read rollno to find details
stop
-
8/13/2019 Programs Copy
83/86
RESULT:
Thus the c program to maintain various number of students record using
array of structures was written, entered, executed and the output wasverified.
-
8/13/2019 Programs Copy
84/86
EX: NO: 10 (c) PROGRAMFOR SIZE OF UNION
FLOWCHART:
start
Read book name,book
price bname,price
Print the bool details
stop
-
8/13/2019 Programs Copy
85/86
RESULT:
Thus the c program to store the book information using union was written,
entered, executed and the output was verified.
-
8/13/2019 Programs Copy
86/86