Group H (Sn.8) Lab Report
Group H (Sn.8) Lab Report
Jahangirnagar University
Course Title#
Registration No. #
Instructions:
1. Don’t copy from other’s assignment. Copying from others will be punished
severely.
2. The student must submit the assignment online (Google
classroom/email/google form etc.) as the course-teacher prescribes.
3. You must use your name# your EXAM ID only for naming your submitted
file.
1|Page
Lab Report 2:
C
Programming
A. Problem definition:
An even number is a number which has a remainder of 0 upon division by 2, while an odd
number is a number which has a remainder of 1 upon division by 2. Now if we understand the
definitions of Odd and Even Number properly, we can easily conclude that if a number is exactly
divisible by 2, then the number is considered as an even number else the number will be
considered as an odd number.
B. Algorithm:
o Step 1: Start
o Step 2: [Take Input] Read: Number
o Step 3: Check: If Number%2 == 0 Then
o Print: N is an Even Number.
o Else
o Print: N is an Odd Number
o Step 4: Stop
C. Flowchart:
2|Page
D. Source Code:
#include<stdio.h>
int main()
{
int n;
printf("Enter your number:");
scanf("%d",&n);
if(n%2==1)
printf("\nNumber is odd\n\n");
else printf("\nNumber is even\n\n");
return 0;
3|Page
}
E. Output:
2. Write a C program which computes the largest number between two numbers.
A. Problem definition:
The problem is to find largest of two given numbers is discussed here. Input two integers from
the user and find the largest number among them. Given two numbers num1 and num2. The
task is to find the largest number among the two.
B. Algorithm:
o Step1: Start
o Step2: Enter first number as No1
o Step3: Enter second Number as No2
o Step4: Check if (No1>No2) then Print No1 is biggest number
Else Print No2 is biggest number
4|Page
o Step5: Stop
C. Flowchart:
D. Source Code:
#include<stdio.h>
int main()
{
int a,b;
printf("Enter your first number:");
scanf("%d",&a);
printf("Enter your second number:");
scanf("%d",&b);
5|Page
//printf("Enter two numbers to add\n");
//scanf("%d%d", &a, &b);
if(a>b)
printf("%d is greater\n",a);
else printf("%d is greater",b);
return 0;
}
E. Output:
A. Problem Definition:
6|Page
Multiplication, one of the four basic operations of arithmetic, gives the result of combining
groups of equal sizes. In other words, multiplication is repeated addition. Multiplication is
represented by the signs cross '×', asterisk '*' or dot '·'. When we multiply two numbers, the
answer we get is called 'product’. The product of two numbers is the result that we get when
we multiply them together.
B. Algorithm:
o Step 1: Start
o Step 2: Read a,b
o Step 4: c=a*b
o Step 5: Print c
o Step 6: Stop
C. Flowchart:
7|Page
D. Source code:
#include<stdio.h>
int main()
{
int a,b,c;
8|Page
4. Write a Program in C which displays division of two numbers.
A. Problem definition:
In C language, when we divide two integers, we get an integer result, e.g., 5/2 evaluates to 2.
As a rule, integer/integer = integer, float/integer = float and integer/float = float. So, we
convert denominator to float in our program, you may also write float in the numerator. This
explicit conversion is known as typecasting.
B. Algorithm:
o Step 1: Start
o Step 2: Input a,b
o Step 4: c=a/b
o Step 3: if(b=0) Display “Enter a non-zero number”
o else Display c
o Step 5: Stop
C. Flowchart:
9|Page
D. Source code:
#include<stdio.h>
int main()
{
int a,b;
float div;
printf("Enter your first number:");
scanf("%d",&a);
printf("Enter your second number:");
scanf("%d",&b);
//printf("Enter two numbers to add\n");
//scanf("%d%d", &a, &b);
/*div defined as a float & cast any one variable a or b.*/
div=a/(float)b; //b cast as float
if (b>0)
printf("\nDivision of two numbers are:%f\n",div);
else printf("No Division");
return 0;
}
E. Output:
10 | P a g e
5. Write a C program
which sum of the series
1+2+3+4+
…………………. +100
A. Problem definition:
The n-th partial sum of a series is the sum of the first n terms. The sequence of partial sums of
a series sometimes tends to a real limit. Sum of the series 1 + 2 + 3 + … + n = n (n+1)/2
B. Algorithm:
o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+i
o Step 6. i=i+1
o Step 7. print the sum
o Step 8. Stop
C. Flow Chart:
11 | P a g e
D. Source code:
#include<stdio.h>
int main()
{
int n,sum;
printf("Enter nth number:");
scanf("%d",&n);
sum=(n*(n+1))/2;
printf("\nSummation 1 to nth number:%d\n",sum);
return 0;
}
12 | P a g e
E. Output:
6. Write a C program which display sum of square sums of first n natural
numbers.
A. Problem definition:
Given a positive integer n. The task is to find the sum of the sum of square of first n natural
number.
Example:
Input: n = 3
Output: 20
Sum of square of first natural number = 1
Sum of square of first two natural number = 1^2 + 2^2 = 5
Sum of square of first three natural number = 1^2 + 2^2 + 3^2 = 14
Sum of sum of square of first three natural number = 1 + 5 + 14 = 20
Input: n = 2
Output: 6
B. Algorithm:
o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+(i*i)
o Step 6. i=i+1
o Step 7. print the sum of square
o Step 8. Stop
13 | P a g e
C. Flowchart:
D. Source code:
#include <stdio.h>
int main() {
int num, square, sum = 0, i = 1;
/* get the input value for n from user */
printf("Enter the value for n:");
scanf("%d", &num);
/* calculate the square of 1st n natural numbers */
while (i <= num) {
14 | P a g e
square = i * i;
sum = sum + square;
i++;
}
/* print the sum of square of first n natural nos */
printf("Sum of squares of first %d natural"
" numbers is %d\n", num, sum);
return 0;
}
E. Output:
A. Problem definition:
In this problem we will see how we can get the sum of cubes of first n natural numbers. Here we
are using one for loop, that runs from 1 to n. In each step we are calculating cube of the term and
then add it to the sum. This program takes O(n) time to complete. But if we want to solve this in
O (1) or constant time, we can use this series formula:
15 | P a g e
B. Algorithm:
o Step 1. Start
o Step 2. Read number num
o Step 3. [Initialize]
sum=0, i=1
o Step 4. Repeat step 4 through 6 until i<=num
o Step 5. sum=sum+(i*i*i)
o Step 6. i=i+1
o Step 7. print the sum of square
o Step 8. Stop
C. Flowchart:
16 | P a g e
D. Source code:
#include<stdio.h>
long cube_sum_n_natural(int n) {
long sum = 0;
int i;
for (i = 1; i <= n; i++) {
sum += i * i * i; //cube i and add it with sum
}
return sum;
}
main() {
int n;
printf("Enter value of n: ");
scanf("%d", &n);
printf("Result is: %ld", cube_sum_n_natural(n));
}
E. Output:
17 | P a g e
8. Write a C program of
multiplication Table Up to 10.
A. Problem definition:
In mathematics, a
multiplication table is a
mathematical table used to define a
multiplication operation for an
algebraic system. Here we will
develop different C program
for Multiplication table
using for loop, using while loop, using do-while loop, from 1 to 10 and from 1 to N.
B. Algorithm:
o Step 1: Start
o Step 2: Input num, the number for which multiplication table is to be printed.
o Step 3: For c = 1 to 10
o Step 4: Print res = num * c
o Step 5: End For loop
o Step6: Stop
C. Flowchart:
D. Source code:
#include <stdio.h>
18 | P a g e
int main()
{
int num, c,res;
E. Output:
19 | P a g e
9. Write a C program
to calculate the
factorial of a given
number.
A. Problem definition:
Factorial of a whole number
'n' is defined as the product
of that number with every
whole number till 1. For
example, the factorial of 4
is 4×3×2×1, which is equal
to 24. It is represented using the symbol '!'. In C program The first function needs to get the
number and pass it back to main, this value then needs to be passed into a second function that
calculates the factorial and passes that value back to main with the result being printed in the
third and final function.
B. Algorithm:
o step 1. Start
o step 2. Read the number n
o step 3. [Initialize]
i=1, fact=1
o step 4. Repeat step 4 through 6 until i=n
o step 5. fact=fact*i
o step 6. i=i+1
o step 7. Print fact
o step 8. Stop
C. Flowchart:
20 | P a g e
int n,i,fact=1; any number:");
printf("Enter
scanf("%d", &n);
for(i=1; i<=n; i++)
fact = fact * i;
printf("Factorial value of %d = %d",n,fact);
return 0;
}
21 | P a g e
E. Output:
10. Write a C program to find a year is Leap Year or not.
A. Problem definition:
A year that has 366 days is called a leap year. A year can be checked whether a year is leap year
or not by dividing the year by 4, 100 and 400. If a number is divisible by 4 but not by 100 then,
it is a leap year. Also, if a number is divisible by 4, 100 and 400 then it is a leap year.
Otherwise, the year is not a leap year.
B. Algorithm:
o Start
o Step 1 → Take integer variable year
o Step 2 → Assign value to the variable
o Step 3 → Check if year is divisible by 4 but not 100, DISPLAY "leap year"
o Step 4 → Check if year is divisible by 400, DISPLAY "leap year"
o Step 5 → Otherwise, DISPLAY "not leap year"
o Stop
22 | P a g e
C. Flowchart:
D. Source code:
#include <stdio.h>
int main()
{
int year;
/* Input year from user */
printf("Enter year : ");
scanf("%d", &year);
/* If year is exactly divisible by 4 and year is not divisible by 100
* or year is exactly divisible by 400 then
* the year is leap year.
* Else year is normal year
*/
if(((year % 4 == 0) && (year % 100 !=0)) || (year % 400==0))
{
printf("LEAP YEAR");
}
23 | P a g e
else
{
printf("COMMON YEAR");
}
return 0;
}
E. Output:
A. Problem definition:
The problem is to check whether a number is positive, negative or zero. Positive numbers are
those whose value are greater than zero, negative numbers value is less than zero.
24 | P a g e
B. Algorithm:
o Step 1: Start
o Step 2: [Input the value of n] read n
o Step 3: [determine whether the given value is positive, negative or zero]
If (n>0), write n as positive and go to step 4
Else, write n as negative and go to step 4
If (n=0), write n as zero and go to step 4
o Step 4: Stop
C. Flowchart:
D. Source code:
#include <stdio.h>
int main()
25 | P a g e
{
int num;
/* Input number from user */
printf("Enter any number: ");
scanf("%d", &num);
if(num > 0)
{
printf("Number is POSITIVE");
}
else if(num < 0)
{
printf("Number is NEGATIVE");
}
else
{
printf("Number is ZERO");
}
return 0;
}
E. Output:
12. Write a C program which finds the largest number from three numbers.
A. Problem Identification:
There are various methods to find the largest number. Like we can use the maximum function
of the programming language directly but the main thing here is understanding how we solve
26 | P a g e
any problem or what is the logic behind the problem and its time complexity. To solve this
problem, we can use only If statements or If and else or nested If and else or using Ternary
Operator. These are all of the same type comparing the numbers which each other. The only
difference is the way of writing. I will be using the Ternary operator as many of them don't use
it but is very useful as with few lines we can write the program.
C program to find largest of three given numbers is discussed here. Input three integers from the
user and find the largest number among them. Given three numbers num1, num2, and num3.
The task is to find the largest number among the three.
B. Algorithm:
o Step 1: start
o Step 2: declare variable a, b and c
o Step 3: read variable a, b and c
o Step 4: if a> b
a>c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b> c
Display b is the largest number
Else
Display c is the largest number
o Step 5: stop
27 | P a g e
C.
Flowchart:
D. Source code:
#include <stdio.h>
int main()
{
float n1, n2, n3;
28 | P a g e
return 0;
}
E. Output:
A. Problem definition:
To calculate a student's average and percentage marks in C programming, we must first enter
marks obtained in several subjects (5 subjects here, i.e., Physics, Chemistry, Math, CS, and
English). Percentage refers to a percentage (hundreds), which is a ratio of parts out of 100. The
percent symbol is percent. We usually count the percentage of marks obtained, the return on
29 | P a g e
Start
investment, and so on. Percentage can also be greater than 100 percent. Percentage is calculated
by dividing the total number of marksmarks,
Declare obtained
sum,byavg,
theperc
total number of marks obtained and
multiplying the result by 100.
B. Algorithm:
o Step 1: Start
o Step 2: Declare mark [5], Seti, sum=0, i=1 perc;
sum, avg,
o Step 3: Set sum=0
o Step 4: if i < 5 then
read mark[i]
update sum = sum + mark [i]
o Step 5: increment i by 1 i<s
o Step 6: if i<5 repeat step 5
o Step 7: calculate avg=sum/5;
perc=(sum/500) *100;
o Step 8: Show avg and perc value
o Step 9: End
Read marks
End
Flowchart:
30 | P a g e
No
Yes
Display Length
Source code:
#include<stdio.h>
int main()
{
int mark[5], i;
31 | P a g e
float sum=0,avg,perc;
printf("Enter marks obtained in Physics, Chemistry, Maths, CS, English :");
for(i=0; i<5; i++)
{
scanf("%d",&mark[i]);
sum=sum+mark[i];
}
avg=sum/5;
perc=(sum/500)*100;
printf("Average Marks = %f",avg);
printf("\nPercentage = %f%",perc);
return 0;}
Output:
32 | P a g e
14. Write a C program to calculate GPA from input marks.
Step 1 : start
Step 2 : read marks or Percentage
Step 3 : if marks >= 80 then grade =A, go to step 7
Step 4 : if marks >= 60 and marks <=80 then grade = B, go to step 7
Step 5 : if marks >=40 and marks <=60 then grade = C go to step 7
Step 6 : display failed
Step 7 : display grade.
Step 8 : stop.
Source code:
#include <stdio.h>
33 | P a g e
int main()
{
int marks;
printf("\n Enter marks:",marks);
scanf("%d",&marks);
if(marks>=90)
printf("\nGPA is A+\n");
else if(marks>=80)
printf(" GPA is A\n");
else if(marks>=70)
printf(" GPA is A-\n");
else if(marks>=60)
printf(" GPA is B+\n");
else if(marks>=50)
printf(" GPA is B\n");
else if(marks>=40)
printf(" GPA is C\n");
else printf("Result is FAIL");
return 0;
}
34 | P a g e
15. Write a C Program Code to Calculate Area and Circumference of Circle.
Principle
The area of a circle is the space occupied by the circle in a two-dimensional plane. The formula for the
area of a circle is pi*r*r and circumference is the any shape defines the path or the boundary that
surrounds the shape. Circumference (or) perimeter of a circle = 2*π*r
Step 1: Start
Step 2: Input r
Step 7: Stop
35 | P a g e
Source Code:
#include<stdio.h>
#include<conio.h>
int main(void)
Output:
Problem identification
36 | P a g e
In this program, we will learn and get code about conversion of temperature value
from Fahrenheit to Celsius. Before going to the program, let's understand about its
celsius = (fahrenheit-32)*(100/180)
To learn more about this formula, then refer to Celsius to Fahrenheit Formula
explanation. There you will get a complete understanding about how this formula is
derived. We know that the title is for Celsius to Fahrenheit, but don't care about it,
you automatically understand about the Fahrenheit to Celsius formula after reading that
program.
celsius = (fahrenheit-32)/(180/100)
And as the value of 180/100 is 1.8, so the previous formula can be further written
as:
celsius = (fahrenheit-32)/1.8
37 | P a g e
Now let's move on to the program written in C for the conversion of Fahrenheit to
Celsius.
Algorithm:
Step 1: Read temperature in Fahrenheit,
Step 2: Calculate temperature with formula C=5/9*(F-32),
Step 3: Print C
Flowchart:
Source code:
int main()
{
float fah, cel;
printf("Enter temperature in Fahrenheit : ");
scanf("%f",&fah);
cel=(fah-32) / 1.8;
printf("Temperature in Celsius = %f",cel);
return 0;
}
38 | P a g e
17. Write a C program which computes the power of a number.
Problem Definition
The program below takes two integers from the user (a base number and an exponent) and
calculates the power.
For example:
In the case of 23
2 is the base number
3 is the exponent
And, the power is equal to 2*2*2 or 4*2
Algorithm:
Step 1: Start
Step 2: Declare variables x,y,n
Step 3 : Input x,n
Step 4 : y=pow(x,n)
Step 5 : Print y
39 | P a g e
Step 6 : Stop
Flowchart:
Source code:
#include<stdio.h>
int main()
{
int x,y,n;
printf("Enter number:",x);
scanf("%d",&x);
printf("\nValue of power:",n);
scanf("%d",&n);
y=pow(x,n);
printf("\nResult is %d\n",y);
40 | P a g e
18. Write a C program which computes the square root and cubic root of a number
Problem Definition
This program will print Square and Cube Root of all Numbers from 1 to N using loop.
Here, we are reading value of N (limit) and will calculate, print the square, cube and square root
of all numbers from 1 to N.
To find square, we are using (i*i), cube, we are using (i*i*i) and square root, we are using sqrt(i).
Here, i is the loop counter and sqrt(i) is the function of math.h, which returns the square root of a
number.
41 | P a g e
Algorithm:
Step 1: Start
Step 2: Declare variables x,y,z
Step 3 : Input x
Step 4 : y=sqrt(x) and z=cbrt(x)
Step 5 : Print y and print z
Step 6 : Stop
Flowchart:
Source code:
#include<stdio.h>
#include<math.h>
int main(void)
{
int x;
float y,z;
//int cubeRoot(x);
42 | P a g e
printf("Enter number:",x);
scanf("%d",&x);
y=sqrt(x);
printf("\nResult is %f\n",y);
z=cbrt(x);
printf("\nResult is %f\n\n",z);
}
43 | P a g e
problem identification:
Swapping is used in various programs like sorting the array. It is mainly used in the
area when we want to store old values without using much space.
in this C program to swap two numbers with and without using a third variable, using
Swapping means interchanging. If the program has two variables a and b where a =
STEP 1: START
STEP 2: ENTER A, B
STEP 3: PRINT A, B
STEP 4: A = A + B
STEP 5: B= A - B
STEP 6: A =A - B
STEP 7: PRINT A, B
STEP 8: END
44 | P a g e
Flowchart (without using third variables)
Source Code
#include <stdio.h>
int main()
int x, y, temp;
temp = x;
x = y;
y = temp;
return 0;
45 | P a g e
Output:
Principle:
46 | P a g e
Flowchart to print Fibonacci
series
Source Code:
#include <stdio.h>
int main()
{
int i, n, t1 = 0, t2 = 1, nextTerm;
Output
47 | P a g e
X=1
Start
Take n numbers
If x<n
21. Write a C program which Checks a number is Prime or Not.
Problem Statement:
Prime number logic: a number is prime if it is divisible only by one and itself. Remember two is
the only even and the smallest prime number. First few prime numbers are 2, 3, 5, 7, 11, 13,
17, .... Prime numbers have many applications in computer science and mathematics. A number
greater than one can be factorized into prime numbers, for example, 540 = 2 2*33*51. To check
whether the input number is a prime number or not a prime number in C programming, you have
to ask to the user to enter a number and start checking for prime number. If number is divisible
by 2 to one less than that number (i.e., n-1), then the number is not prime number, otherwise it
will be prime number.
B. Algorithm:
Step 1: Start
Step 6: else
Step 7: Stop
C. Flowchart:
48 | P a g e
Stop
Print “Number x=x+1 Print “Number
is prime” is not prime”
If n\
x=1
D. Source Code:
Following C program ask the user to enter a number to check whether it is a prime number or
not, then display it on the screen:
#include<stdio.h>
int main()
{ int num,i,count=0;
printf("Enter a number:");
scanf("%d",&num);
for(i=2;i<num;i++)
49 | P a g e
{
if(num%i==0)
{ count++;
break;
} }
if(count==0)
else
return 0;
Output:
50 | P a g e
22. Write C program which checks a patient is in diabetics or not.
Problem Definition
Diabetes is a chronic disease that occurs either when the pancreas does not produce enough
insulin or when the body cannot effectively use the insulin it produces. A blood sample will be
taken after an overnight fast. A fasting blood sugar level less than 100 mg/dL (5.6 mmol/L) is
normal. A fasting blood sugar level from 100 to 125 mg/dL (5.6 to 6.9 mmol/L) is considered
prediabetes. If it's 126 mg/dL (7 mmol/L) or higher on two separate tests, you have diabetes.
In oral glucose tolerance test a blood sugar level less than 140 mg/dL (7.8 mmol/L) is normal. A
reading of more than 200 mg/dL (11.1 mmol/L) after two hours indicates diabetes. A reading
between 140 and 199 mg/dL (7.8 mmol/L and 11.0 mmol/L) indicates prediabetes.
Algorithm
Step 1: Start
Step 2: Enter Blood glucose level
Step 3: Check if bg<= 6.5
Print patient is healthy
Step 4: Check if bg<=7.0
Print patient is in pre diabetics
Else Print patient is in diabetics
Step 5: Stop
Flowchart
51 | P a g e
Source Code
#include <stdio.h>
int main()
{
float bg;
printf("\n Enter blood glucose level:",bg);
scanf("%f",&bg);
if(bg<=6.5)
printf("\n Patient is healthy.\n");
else if(bg<=7.0)
printf("\n Patient is in pre-diabetics.\n");
else printf("\nPatient is in diabetics.\n");
52 | P a g e
return 0;
}
Output
23. Write a C program which mapping a patient has what type of disease.
Problem Definition
Disease is a particular quality or disposition regarded as adversely affecting a person or group of
people. Here we will see three phase of person. We indicate blood glucose as bg,low density
lipoprotein ldl, high density lipoprotein as hdl, low blood pressure as bpl, high blood pressure as
bph.
If anyone have bg<=6.5,ldl<=120, hdl<=20, bpl<=80, bph<=120 then the patient is healthy. Else
bg>=7.0 ldl<=180, hdl<=300, bpl<=90, bph<=130 patient is in pre-diabetics and pre-
hypertension. Else if Patient is in diabetics and severly heart disease.
B. Algorithm
Step 1: Start
Step2: Input blood glucose as bg,low density lipoprotein ldl, high density lipoprotein as hdl, low
blood pressure as bpl, high blood pressure as bph.
Step3: If anyone have bg<=6.5,ldl<=120, hdl<=20, bpl<=80, bph<=120 , Print the patient is
healthy.
Step 4: Else bg>=7.0 ldl<=180, hdl<=300, bpl<=90, bph<=130 print patient is in pre-diabetics
and pre-hypertension.
C. Flowchart
53 | P a g e
D. Source Code
#include <stdio.h>
int main()
float bg,ldl,hdl,bpl,bph;
scanf("%f",&bg);
scanf("%f",&ldl);
scanf("%f",&hdl);
scanf("%f",&bpl);
54 | P a g e
printf("\n Enter BPH limit:");
scanf("%f",&bph);
if(bg<=6.5&&ldl<=120&&hdl<=200&&bpl<=80&&bph<=120)
else if(bg>=7.0&&ldl<=180&&hdl<=300&&bpl<=90&&bph<=130)
return 0;
E. Output
55 | P a g e
24. write a C program to display characters from A to Z using loop.
A.Problem Definition:
In any programing language including C, loops are used to execute a set of statements repeatedly
until a particular condition in satisfied. In this program, the for loop is used to display the
English alphabet in uppercase. Here's a little modification of the above program.
The program displays the English alphabet in either uppercase or lowercase depending upon the
input given by the user. For example, Alphabets from A-Z are, A B C D F F G H I J K L M N O
P Q R S T U V W X Y Z.
B.Algorithm:
1. Start
7. Stop.
C.Flowchart:
56 | P a g e
D.Source Code:
We will learn to display the English alphabets using for loop in this example.
#include <stdio.h>
int main()
{
char c
for(c = 'A'; c <= 'Z'; ++c)
printf("%c ", c);
printf("\n");
return 0;
}
E.Output
ABCDEFGHIJKLMNOPQRSTUVWXYZ
57 | P a g e
25. Write a C program which displays your name.
Algorithm:
Step 1: Start
Step 2: Declare the variable of your name
Step 3: Enter your name
Step 4: Print your name
Step 5: End
Flow chart:
Source code
#include<stdio.h>
int main()
{
char str[100];
printf("Enter your name:");
58 | P a g e
scanf("%s",str);
printf("\nMy name is %s\n",str);
return 0;
}
Output:
59 | P a g e
26. Write a C program to check whether a character is uppercase or lowercase
Problem statement:
As we all know, in the English language, there are a couple of cases of the alphabets. They are
known as Upper Case and Lower Case. This is how both of those look like:
As we can see, the left character is the Upper Case A and the right character is the Lower Case a.
This specific article deals with the C programs to distinguish between both of these.
Programming languages are case sensitive. It’s has taken an uppercase character and a lowercase
character separately. With C programming language we can easily identify whether a character is
uppercase or lowercase. the program displays whether the entered character is lowercase
alphabet or uppercase alphabet by checking its ASCII value. We know that the ASCII value of
lowercase alphabet ‘a’ is 97, ‘b’ is 98 … ‘z’ is 122. And the ASCII value of uppercase alphabet
‘A’ is 65, ‘B’ is 66 … ‘Z’ is 90. As for example ASCII code of letter ‘A’=65 and ‘a’=97.
However, the difference of ASCII code between letter ‘A’ and ‘a’ is 32. So, System takes these
letter separately because of uppercase and lowercase.
Algorithm:
60 | P a g e
Flowchart
Source Code:
61 | P a g e
/**
* C program to check whether a character is uppercase
* or lowercase using inbuilt library functions
*/
#include <stdio.h>
#include <ctype.h> /* Used for isupper() and islower() */
int main()
{
char ch;
if(isupper(ch))
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(islower(ch))
{
printf("'%c' is lowercase alphabet.", ch);
}
else
{
printf("'%c' is not an alphabet.", ch);
}
return 0;
}
Output
62 | P a g e
63 | P a g e
It’salphabet
It’s digit
Not alphabet and not a digit
Declarechthe
>=variables
'0'
ch >=Start
'A' &&
&&End ch <=
ch <= 'Z'
'9'
Problem definition:
A character is alphabet if it in between a-z or A-Z.
A character is digit if it is in between 0-9.
A character is special symbol character if it neither alphabet nor digit.
Algorithm:
Step 1: Start
Step 2: Declare the variables
Step 3: Enter the character
Step 4: Print the character
Step 5: Stop
Flow Chart:
True
False
True
False
Source Code:
64 | P a g e
#include <stdio.h>
main() {
char ch;
printf("Enter a character: ");
scanf("%c", &ch);
if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
printf("This is an alphabet");
else if(ch >= '0' && ch <= '9')
printf("This is a number");
else
printf("This is a special character");
}
Output:
65 | P a g e
28. Write a program in C to check whether a character is vowel or consonant.
Problem definition: There are 26 alphabets in our English language. Out of which, 21 are consonants
and five are vowels. The five vowels are A,E,I,O,U.
Algorithm:
o Step 1: Start
o Step 2: Declare character type variable ch
o Step 3: Read ch from User
o Step 4: // Checking both lower and upper case vowels.
IF (ch == 'a' || ch == 'A' ||
ch == 'e' || ch == 'E' ||
ch == 'i' || ch == 'I' ||
ch == 'o' || ch == 'O' ||
ch == 'u' || ch == 'U' )
Print "Vowel"
ELSE
Print "Consonant"
o Step 5: Stop
Flowchart:
66 | P a g e
Source code:
#include <stdio.h>
int main() {
char c;
scanf("%c", &c);
if (lowercase_vowel || uppercase_vowel)
67 | P a g e
else
printf("%c
is a
consonant.", c);
return 0;
Output:
PROBLEM DEFINITION:
In C program, user would be asked to enter a String (it can be in complete uppercase or partial
uppercase) and then the program would convert it into a complete (all characters in lower case)
lower case string. The logic we have used in the following program is: All the upper-case
characters (A-Z) have ASCII value ranging from 65 to 90 and their corresponding lower-case
characters (a-z) have ASCII value 32 greater than them. For example ‘A ‘has a ASCII value 65
and ‘a ‘has a ASCII value 97 (65+32). Same applies for other characters.
ALGORITHM:
68 | P a g e
str[i] = str[i] + 32;)
Step 3: print(str);
FLOWCHART:
SOURCE CODE:
#include<stdio.h>
Int main()
{
char ch;
printf("Enter a character in uppercase : ");
scanf("%c",&ch);
ch=ch+32;
printf("character in lowercase = %c",ch);
return 0;
}
69 | P a g e
OUTPUT:
Problem Definition:
Programming languages are case sensitive. It’s has taken an uppercase character and a lowercase
character separately. In C programming language we can easily identify whether a character is
uppercase or lowercase by using a small program. A computer function depends on machine
language or binary code. Anything we input in computer first it converted to binary language and
then it functions as per instruction. Every character we input has an ASCII unique code that
exchange to binary code by the system. As for example ASCII code of letter ‘A’=65 and ‘a’=97.
However, the difference of ASCII code between letter ‘A’ and ‘a’ is 32. So, System takes these
letters separately because of uppercase and lowercase. So, in programming language we must
careful to use uppercase and lowercase character when use. A small C programming developed
below to identify uppercase and lowercase character.
#Algorithm:
Step1: Start the program
Step1: Input your character
Step3: check: if character is upper or lower or is not a letter
Step4: Print
Step5: End the program
70 | P a g e
Start
T
Ch>= ‘a’ &&
Ch<= ‘z’
T Ch<= ‘A’ Ch is in
lowercase
Ch is in
uppercase F
Invalid
End
71 | P a g e
Source Code:
/**
* C program to check whether a character is uppercase
* or lowercase using inbuilt library functions
*/
#include <stdio.h>
#include <ctype.h> /* Used for isupper() and islower() */
int main()
{
char ch;
if(isupper(ch))
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(islower(ch))
{
printf("'%c' is lowercase alphabet.", ch);
}
else
{
printf("'%c' is not an alphabet.", ch);
}
return 0;
}
Output:
72 | P a g e
31. Write a C program which reverses a string.
PROBLEM DEFINITION:
Step 1: Start
Step 2: Read the string from the user
Step 3: Calculate the length of the string
Step 4: Initialize rev = “ ” [empty string]
Step 5: Initialize i = length - 1
Step 6: Repeat until i>=0:
6.1: rev = rev + Character at position 'i' of the string
6.2: i = i – 1
Step 7: Print rev
Step 8: Stop
FLOWCHART:
SOURCE CODE:
#include <string.h>
#include <stdio.h>
int main()
73 | P a g e
{
char arr[100];
gets(arr);
strrev(arr);
return 0;}
output:
Problem definition: C program to concatenate two strings, for example, if the first string is "C
programming" and the second string is " language" (note space before language) then on
concatenating these two strings we get the string "C programming language." To concatenate
two strings we use strcat function of string.h, to concatenate without using library function see
another code below which uses pointers.
Algorithm:
Step 1: Start
74 | P a g e
Declare
Start a,b
Read a and b
Step Strcat
5: End(a,b)
Flowchart:
End
Source code:
#include <stdio.h>
#include <string.h>
int main()
gets(a);
75 | P a g e
gets(b);
strcat(a, b);
return 0;
Output:
Problem definition:
The total number of characters in a string is referred to as its length. We can easily identify total
string by using the C programming language. The strlen() function in C is the best way to
determine the length of a string. However, using the following C program, we will manually
determine the length of a string.
Algorithm:
Step 1: Start
Step 2: Declare A [L…U], l, i
Step 3: Set l=0
Step 4: Reading string is A
76 | P a g e
Length= number*length
Start
Stop
Display
Read Length
number
Source code:
#include <stdio.h>
#include <string.h>
77 | P a g e
int main ()
{
char a [100];
int length;
printf("Enter a string\n");
gets(a);
length = strlen(a);
printf("Length of the string = %d\n", length);
return 0;
}
Output:
Problem definition:
For reading a line from a file in C programming we should have the knowledge of the following
C programming topics:
78 | P a g e
C File Handling: A file is a container in computer storage in this tutorial, we will learn about file
handling in C. We will learn to handle standard I/O in C using fprintf(), fscanf(), fread(),
fwrite(), fseek() etc. with the help of examples.A file is a container in computer storage devices
used for storing data.e devices used for storing data.
C Programming Strings: We'll learn about strings in C programming. We'll learn to declare them,
initialize them and use them for various I/O operations with the help of examples.In C
programming, a string is a sequence of characters terminated with a null character \0.
Algorithm:
o Step 1: Start
o Step 2: Declare *Fptr as File
o Step 3: Declare C as character
o Step 4: Opening an Existing file go to step 5
o Step 5: Print “hi my name is C” go to step 6
o Step 6: Exit
o Step 7: Reading from file (fscanf)
o Step 8: Print Data from the file
o Step 9: Closing file (fclose)
o Step 10: End
Flowchart:
Flow chart:
START
Declare C as character
fopen(Fptr)
Read fscan
fclose(Fptr)
END
Source Code:
79 | P a g e
#include <stdio.h>
//#include,stdio.h>
#include <stdlib.h> // For exit() function
int main()
{
char c[1000];
FILE *fptr;
if ((fptr = fopen("program.txt", "r")) == NULL)
{
printf("Error! opening file");
// Program exits if file pointer returns NULL.
exit(1);
}
// reads text until newline
fscanf(fptr,"%[^\n]", c);
printf("\nData from the file:\n%s\n\n", c);
fclose(fptr);
return 0;
}
Output:
80 | P a g e
Lab Report 3: Database Management System
81 | P a g e
1. Hospital Information system
Problem definition
In HIS we described four entities and each entity has several attributes as follows:
To draw a ER diagram for HIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
ER Diagram of HIS:
82 | P a g e
INCLUDEPICTURE "http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://i.imgur.com/zSRul3D.jpg" \* MERGEFORMATINET
83 | P a g e
Database design and development:
SQL query to form HIS database:
Database changed
values(4001,'dr.Mahfuz','MBBS,MPH',60000,4001);
values(2001,'hbs_AG','06-03-2019',3001);
84 | P a g e
Results and Discussion:
select pname from patient where pdiagnosis='hbs_AG';
+-------+
| pname |
85 | P a g e
+-------+
| pinky |
+-------+
+-------+
| pname |
+-------+
| mesbah |
+-------+
+---------+--------------------+-----------+-------+--------+--------+
+---------+--------------------+-----------+-------+--------+--------+
+---------+--------------------+-----------+-------+--------+--------+
.hosp_id;
+-----------+--------------------+
| dname | hos_name |
+-----------+--------------------+
| dr.Zorich | Apollo |
86 | P a g e
select dname from doctor,hospital where doctor.hosp_id=hospital.hosp_id and
hos_name='Apollo';
+-----------+
| dname |
+-----------+
| dr.Zorich |
+-----------+
d and dname='dr.Mahfuz';
+--------------------+
| hos_name |
+--------------------+
| Prescription Point |
+--------------------+
87 | P a g e
88 | P a g e
89 | P a g e
2. Student information management system
Problem definition:
A student information management system is a management information system for education
establishments to manage student data. Student information systems provide capabilities for registering
students in courses; documenting grading, transcripts, results of student tests and
other assessment scores; building student schedules; tracking student attendance; and managing many
other student-related data needs in a school.
In SIMS we described four entities and each entity has several attributes as follows:
90 | P a g e
admin (aid, name, loginname, password)
To draw a ER diagram for SMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
91 | P a g e
Database design and development:
SQL query to form SMS database:
Use sms;
Mysql>database changed
values(1001,'mr.chein','chein','chein123',2001);
values(2001,’SPSS’,2000,'6month',3001,4001);
+-----------+-------------+------+-----+---------+----------------+
+-----------+-------------+------+-----+---------+----------------+
+-----------+-------------+------+-----+---------+----------------+
92 | P a g e
insert into teacher(tid,name,course,education,cid)
values(3001,'dr.shamim','SPSS','PhD',2001);
values(4001,'Zenith','SPSS','B.Sc','Dhaka','paid’,2001);
+------+-----------+--------+-----------+------+
+------+-----------+--------+-----------+------+
+------+-----------+--------+-----------+------+
93 | P a g e
94 | P a g e
mysql> select name from course,teacher where teacher.cid=course.cid and course='SPSS';
+-----------+
| name |
95 | P a g e
+-----------+
| dr.shamim |
+-----------+
SPSS';
+--------+
| name |
+--------+
| Zenith |
+--------+
96 | P a g e
mysql> select fees from course where cname='SPSS';
+------+
| fees |
+------+
| 2000 |
+------+
97 | P a g e
mysql> select name from admin,course where admin.cid=course.cid and cname='SPSS';
+----------+
| name |
+----------+
| mr.chein |
+----------+
98 | P a g e
3. Laboratory information management system
Problem definition:
A laboratory information management system (LIMS), sometimes referred to as a laboratory
information system (LIS) or laboratory management system (LMS), is a software-based solution
with features that support a modern laboratory's operations. Key features include—but are not
limited to—workflow and data tracking support, flexible architecture, and data exchange
interfaces, which fully "support its use in regulated environments". The features and uses of a
LIMS have evolved over the years from simple sample tracking to an enterprise resource
planning tool that manages multiple aspects of laboratory informatics.
99 | P a g e
To draw a ER diagram for LIMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
ER Diagram of LIMS:
100 | P a g e
Database changed
values(1001,'pathology',027710004,'Dhaka','blood sugar','10amto8pm',4001);
values(4001,'mr.zorich','dhaka','male',38,027786907,3001,2001);
values(2001,'pharmacist',4001);
values(3001,3500,500,4001);
101 | P a g e
Results and discussion:
mysql> select* from bill;
+--------+------------+-----------------+------+
+--------+------------+-----------------+------+
+--------+------------+-----------------+------+
102 | P a g e
103 | P a g e
mysql> select name,testcharge from lab,bill;
+-----------+------------+
| name | testcharge |
+-----------+------------+
104 | P a g e
| pathology | 3500 |
+-----------+------------+
+------------+
| testcharge |
+------------+
| 3500 |
+------------+
105 | P a g e
mysql> select name from patient,bill where patient.p_id=bill.p_id and testcharge
=3500;
+-----------+
| name |
+-----------+
| mr.zorich |+-----------+
106 | P a g e
4. Pharmacy Information System
Problem definition
A pharmacy information system (PIS) is a system that has many different functions in order to
maintain the supply and organization of drugs. It can be a separate system for pharmacy usage
only, or it can be coordinated with an inpatient hospital computer physician order entry (CPOE)
system. A PIS paired with a CPOE allows for an easier transfer of information.
A PIS is used to reduce medication errors, increase patient safety, report drug usage, and track
costs. Inpatient pharmacy information systems are used in the hospital setting while outpatient
pharmacy information systems are used in home settings for discharged patients, clinics, long-
term care facilities, and home health care. Most of the uses and capabilities of the PIS are similar
for inpatient and outpatient settings. However, the outpatient PIS has a stronger emphasis on
medication labeling, drug warnings, and instructions for administration.
Historically, the societal purpose of pharmacy has been to make drugs and medicines available.
While this core function of pharmacy remains unchanged, the profession's purpose has evolved
with new medical and pharmaceutical knowledge and technological advancements.
Entity of PIS as follows:
In PIS we described five entities and each entity has several attributes as follows:
admin (id,user_id,mobile,status,password)
supplier (id,user_id,mobile,status,password)
107 | P a g e
product(pro_id,pro_author,pro_details,pro_baseprice,pro_buyer,pro_soldprice,pro_status)
buyer(buyer_id,mobile,status,password)
bid_product(bid_pro_id,bid_buyer_name,bid_price,status)
To draw a ER diagram for PIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
ER Diagram of PIS:
108 | P a g e
ER-Diagram of pharmacy information system
Use pims;
values(1001,01912345678,'in-servics','drasad',2001,3001);
values(2001,'active','aksixteen',1001,4001);
values(3001,011234567,'login','fifteen',5001,1001);
values(4001,'square','injection',340,310,'qc passed',2001);
109 | P a g e
create table bid_product(bid_product_id int not null auto_increment,bid_buyer_name
varchar(40),bid_price int(10),status varchar(20),buyer_id int(10),primary key(bid_product_id));
values(5001,'dr.mahfuz',1100,'good',3001);
+----------+----------+--------+----------+----------------+----------+
+----------+----------+--------+----------+----------------+----------+
+----------+----------+--------+----------+----------------+----------+
110 | P a g e
111 | P a g e
112 | P a g e
select pro_autor from product,supplier where product.pro_id=supplier.pro_id and
admin_id=1001;
+-----------+
| pro_autor |
+-----------+
| square |
+-----------+
113 | P a g e
select pro_details,pro_baseprice from product;
+-------------+---------------+
| pro_details | pro_baseprice |
+-------------+---------------+
| injection | 340 |
+-------------+---------------+
114 | P a g e
select pro_baseprice from product where pro_soldprice=310;
+---------------+
| pro_baseprice |
+---------------+
| 340 |
115 | P a g e
mysql> select pro_details from product where pro_soldprice=310;
+-------------+
| pro_details |
+-------------+
| injection |
+-------------+
116 | P a g e
mysql> select bid_buyer_name from bid_product,buyer where buyer.buyer_id=bid_pro
duct.buyer_id;
+----------------+
| bid_buyer_name |
+----------------+
| dr.mahfuz |
+----------------+
117 | P a g e
5. Emergency Department Information System
Problem definition
The purpose of the emergency room is to treat critically ill patients and to prevent cardiac arrest
in patients presenting with signs of physiological instability.
Health uses the Emergency Department Information System (EDIS) to assist in the management
of emergency departments. This system is both a workflow and a data collection tool designed to
capture real-time information about patients, and to support the operational control of Health
emergency departments. EDIS is used when a patient presents to an emergency department to
capture key information including:
patient identity (unique identifier generated or existing in the system) such as date of
birth, address, occupation, next of kin
insurance status (Medicare or Private)
admission time
mode of arrival (e.g. ambulance, private transport)
treating medical professional (e.g. doctor or nurse)
primary diagnosis
outcome (i.e. admitted to hospital or discharged)
discharge and departure date
118 | P a g e
Data from EDIS is used for emergency department (ED) performance and management
reporting. This includes:
patient(pat_id,name,gender,age,notes)
registration (reg_no,date,assurance)
doctor (doc_id,name,gender,age,specialist)
medicalrecord(mr_no,date,diagnos,drugs,reference)
administration (admin_id,endorsem,letter_no)
healthoffice (rec_id,rec_name)
To draw a ER diagram for PIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
ER Diagram of EDIS:
119 | P a g e
Figure: ER-diagram of emergency department information system
Database changed
values(3001,'abir','male',12,'he is week',4001,5001);
120 | P a g e
insert into registration(reg_no,date,assurance,pat_id)
values(5001,'01-03-2019','quality treatment',3001);
values(4001,'dr.mahfuz','male','40','dentist',3001,6001);
values(6001,'11-03-2019','blood-glucose','insulin','avoid sugar',4001,1001);
values(1001,'yes','a/223/2019',6001,2001);
values(2001,'mr.rubayet',1001);
121 | P a g e
122 | P a g e
Results and Discussion:
+--------+------------+-------------------+--------+
+--------+------------+-------------------+--------+
+--------+------------+-------------------+--------+
123 | P a g e
124 | P a g e
125 | P a g e
select diagnos from medicalrecord,doctor where doctor.mr_no=medicalrecord.mr_no and
name='dr.mahfuz';
+---------------+
| diagnos |
+---------------+
| blood-glucose |
+---------------+
126 | P a g e
select name from patient,registration where patient.pat_id=registration.pat_id and date='01-03-
2019';
+------+
| name |
+------+
| abir |
+------+
127 | P a g e
select rec_name from healthoffice,administration where administration.adm
+------------+
| rec_name |
+------------+
| mr.rubayet |
+------------+
128 | P a g e
select name,specialist from doctor;
+-----------+------------+
| name | specialist |
+-----------+------------+
| dr.mahfuz | dentist |
+-----------+------------+
129 | P a g e
mysql> select name,specialist from doctor where name='dr.mahfuz';
+-----------+------------+
| name | specialist |
+-----------+------------+
| dr.mahfuz | dentist |
+-----------+------------+
130 | P a g e
6. Nursing Information System
Problem definition
Nursing Information System (NIS) is a part of a health care information system that deals with
nursing aspects, particularly the maintenance of the nursing record. Nursing informatics (NI) is
the specialty that integrates nursing science with multiple information management and
analytical sciences to identify, define, manage, and communicate data, information, knowledge,
and wisdom in nursing practice. NI supports nurses, consumers, patients, the interprofessional
healthcare team, and other stakeholders in their decision-making in all roles and settings to
achieve desired outcomes. This support is accomplished through the use of information
structures, information processes, and information technology. The several objectives that a
Nursing Information system should meet in order to succeed its aims, cover the users' needs and
operate properly are described. The functions of such systems, which combine with the basic
tasks of the nursing care process, are examined.
admin (admin_id,admin_name)
nurse (nurse_id,nurse_name,services,ward_no)
131 | P a g e
patient (pat_id, pat_name,age,contact,gender,disease,address)
drugs (drugs_id,drug_name)
stocks (stock_id,drugs_id,quantity)
To draw a ER diagram for LIMS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
ER Diagram of NIMS:
132 | P a g e
Database design and development:
Database changed
Database changed
+----------------+
| Tables_in_nims |
+----------------+
| admin |
| drugs |
| nurse |
| patient |
133 | P a g e
| stocks |
+----------------+
+------------+-------------+------+-----+---------+----------------+
+------------+-------------+------+-----+---------+----------------+
+------------+-------------+------+-----+---------+----------------+
values(1001,'mr.patrick',2001);
desc nurse;
+------------+-------------+------+-----+---------+----------------+
+------------+-------------+------+-----+---------+----------------+
134 | P a g e
| pat_id | int(10) | YES | | NULL | |
+------------+-------------+------+-----+---------+----------------+
desc patient;
+----------+-------------+------+-----+---------+----------------+
+----------+-------------+------+-----+---------+----------------+
+----------+-------------+------+-----+---------+----------------+
values(3001,'abir',12,01914134405,'male','fever','savar,dhaka',2001);
desc drugs;
+------------+-------------+------+-----+---------+----------------+
+------------+-------------+------+-----+---------+----------------+
135 | P a g e
| drugs_id | int(11) | NO | PRI | NULL | auto_increment |
+------------+-------------+------+-----+---------+----------------+
values(4001,'aspirin',2001,5001);
desc stocks;
+----------+---------+------+-----+---------+----------------+
+----------+---------+------+-----+---------+----------------+
+----------+---------+------+-----+---------+----------------+
values(5001,4001,4000);
+----------+------------+----------+----------+
+----------+------------+----------+----------+
+----------+------------+----------+----------+
136 | P a g e
select pat_name from patient,nurse where patient.nurse_id=nurse.nurse_id and nurse_name='mst
zerin';
+----------+
| pat_name |
+----------+
| abir |
+----------+
+------------+
| nurse_name |
+------------+
| mst zerin |
+------------+
and quantity=4000;
+------------+
| drugs_name |
+------------+
| aspirin |
+------------+
d drugs_name='aspirin';
+----------+
| quantity |
+----------+
137 | P a g e
| 4000 |
+----------+
test (test_id,test_name,date,time,result)
To draw a ER diagram for CIS we need cardinal relation for understanding entity to entity
relation. Relation like as 1………...1, 1….…..…N(many) or N(many)…………….M(many).
Tools:
We have used MYSQL to write SQL query and MySQL-Front to view database.
ER Diagram of CIMS:
138 | P a g e
Figure: ER Diagram of CIS
Database changed
values(1001,'dr.mahfuz','Dentist',2001,3001);
values(2001,'Abir','Life insurance','05-03-2019','12-03-2019',1001,3001);
139 | P a g e
create table test(test_id int not null auto_increment,test_name varchar(20),date varchar(15),time
varchar(15),result varchar(30),doc_id int(10),pat_id int(10),primary key(test_id));
values(3001,'hbs-ag','5-03-2019','9:00 am','negative',1001,2001);
Database changed
+----------------+
| Tables_in_cims |
+----------------+
| doctor |
| patient |
| test |
+----------------+
140 | P a g e
select* from doctor;
+--------+-----------+----------------+--------+---------+
+--------+-----------+----------------+--------+---------+
+--------+-----------+----------------+--------+---------+
+---------+-----------+-----------+---------+----------+--------+--------+
+---------+-----------+-----------+---------+----------+--------+--------+
+---------+-----------+-----------+---------+----------+--------+--------+
141 | P a g e
select pname from patient,doctor where patient.pat_id=doctor.pat_id and dname='dr.mahfuz';
+-------+
| pname |
+-------+
| Abir |
+-------+
142 | P a g e
select dname from patient,doctor where patient.pat_id=doctor.pat_id and pname='Abir';
+-----------+
| dname |
+-----------+
| dr.mahfuz |
+-----------+
143 | P a g e
select pname from patient where date_shifted='05-03-2019';
+-------+
| pname |
+-------+
| Abir |
+-------+
144 | P a g e
select pname from patient where date_checked_out='12-03-2019';
+-------+
| pname |
+-------+
| Abir |
+-------+
145 | P a g e
select test_name,result from test where pat_id=2001;
+-----------+----------+
| test_name | result |
+-----------+----------+
| hbs-ag | negative |
+-----------+----------+
146 | P a g e
8. Executive Information System (EIS):
An executive information system (EIS) is a decision support system (DSS) used to assist senior
executives in the decision-making process. It does this by providing easy access to important
data needed to achieve strategic goals in an organization. An EIS normally features graphical
displays on an easy-to-use interface.
Executive information systems can be used in many different types of organizations to monitor
enterprise performance as well as to identify opportunities and problems.
EIS helps management to monitor performance of the organization and thus helps organization
to achieve its goals and objectives in the long run.
147 | P a g e
c) Senior Executive Officer(SEO): seo_name, seo_id, _add, seo_salary, seo_performance,
record_id.
d) Employee: emp_name, emp_id, emp_dep, emp_salary, emp_performance, record_id.
e) Leave: LvEmp_id, LvEmp_dep, leave_status, leave_type, leave_no, record_id.
SQL query to form EIS database:
148 | P a g e
comp_addres comp_id
s
comp_name
Company
insert into LV (lvEmp_id,lvEmp_name,leave_dep,leave_stat,leave_type,leave_no,record_id)
comp_type
record_id
values(8001,’Asad’,’Finance’,’on_leave’,’casual_leave’,01,9001);
Has
record_id
ceo_address
Direct seo_addres
s s
seo_name seo_id
record_id
SEOs
seo_salary seo_performance
emp_id
Mana
emp_name ges
Employee
emp_dept
lvEmp_id
record_id
emp_salary
Leave lvEmp_name
emp_performance leave_no
leave_dep
leave_type
record_id leave_stat
149 | P a g e
Result and Discussion:
150 | P a g e
151 | P a g e
152 | P a g e