Set A . Apply all the three program development steps for the following examples.
1. Accept dimensions of a cylinder and print the surface area and volume (Hint: surface area =2πr2 + 2πrh, volume = πr2h)
2. Accept temperatures in Fahrenheit (F) and print it in Celsius(C) and Kelvin (K) (Hint: C=5/9(F-32), K = C + 273.15)
3. Accept initial velocity (u), acceleration (a) and time (t). Print the final velocity (v) and the distance (s) travelled. (Hint: v = u + at, s = u + at2)
4. Accept inner and outer radius of a ring and print the perimeter and area of the ring (Hint:perimeter = 2 π (a+b) , area = π (a2-b2) )
5. Accept two numbers and print arithmetic and harmonic mean of the two numbers (Hint: AM=(a+b)/2 , HM = ab/(a+b) )
6. Accept three dimensions length (l), breadth(b) and height(h) of a cuboid and print surface area and volume (Hint : surface area=2(lb+lh+bh ), volume = lbh )
7. Accept a character from the keyboard and display its previous and next character in order.Ex. If the character entered is ‘d’, display “The previous character is c”, “The next character is e”.
8. Accept a character from the user and display its ASCII value.
Set B . Apply all the three program development steps for the following examples.
1. Accept the x and y coordinates of two points and compute the distance between the two points.
2. Accept two integers from the user and interchange them. Display the interchanged numbers.
3. A cashier has currency notes of denomination 1, 5 and 10. Accept the amount to be withdrawn from the user and print the total number of currency notes of each denomination thecashier will have to give.
Set C. Write a program to solve the following problems
1. Consider a room having one door and two windows both of the same size. Accept dimensions of the room, door and window. Print the area to be painted (interior walls) and area to be whitewashed (roof).
2. The basic salary of an employee is decided at the time of employment, which may be different for different employees. Apart from basic, employee gets 10% of basic as house rent,30% of basic as dearness allowance. A professional tax of 5% of basic is deducted from salary.Accept the employee id and basic salary for an employee and output the take home salary of the employee.
1. Accept dimensions of a cylinder and print the surface area and volume (Hint: surface area =2πr2 + 2πrh, volume = πr2h)
2. Accept temperatures in Fahrenheit (F) and print it in Celsius(C) and Kelvin (K) (Hint: C=5/9(F-32), K = C + 273.15)
3. Accept initial velocity (u), acceleration (a) and time (t). Print the final velocity (v) and the distance (s) travelled. (Hint: v = u + at, s = u + at2)
4. Accept inner and outer radius of a ring and print the perimeter and area of the ring (Hint:perimeter = 2 π (a+b) , area = π (a2-b2) )
5. Accept two numbers and print arithmetic and harmonic mean of the two numbers (Hint: AM=(a+b)/2 , HM = ab/(a+b) )
6. Accept three dimensions length (l), breadth(b) and height(h) of a cuboid and print surface area and volume (Hint : surface area=2(lb+lh+bh ), volume = lbh )
7. Accept a character from the keyboard and display its previous and next character in order.Ex. If the character entered is ‘d’, display “The previous character is c”, “The next character is e”.
8. Accept a character from the user and display its ASCII value.
Set B . Apply all the three program development steps for the following examples.
1. Accept the x and y coordinates of two points and compute the distance between the two points.
2. Accept two integers from the user and interchange them. Display the interchanged numbers.
3. A cashier has currency notes of denomination 1, 5 and 10. Accept the amount to be withdrawn from the user and print the total number of currency notes of each denomination thecashier will have to give.
Set C. Write a program to solve the following problems
1. Consider a room having one door and two windows both of the same size. Accept dimensions of the room, door and window. Print the area to be painted (interior walls) and area to be whitewashed (roof).
2. The basic salary of an employee is decided at the time of employment, which may be different for different employees. Apart from basic, employee gets 10% of basic as house rent,30% of basic as dearness allowance. A professional tax of 5% of basic is deducted from salary.Accept the employee id and basic salary for an employee and output the take home salary of the employee.
8 Comments
Addition programme
ReplyDeleteredhatt
ReplyDeletehttps://youtu.be/-iQnt159PDk?si=qxGQlOY0jL7662uM
SCAN.
ReplyDelete#include
#include
void scan(int req[],int n,int head,int size,int dir)
{
int seek=0,i,j,temp,bound=size,start;
for(i=0;ireq[j])
{
temp=req[i];
req[i]=req[j];
req[j]=temp;
}
}
}
for(start=0;start=head)
{
break;
}
printf("seek sequence:%d",head);
if(dir==1)
{
for(i=start;i%d",head);
}
seek+= abs(bound - head);
head = bound;
printf(" ->%d",head);
for(i=start-1;i>=0;i--)
{
seek+=abs(req[i]-head);
head=req[i];
printf("->%d",head);
}
}
else
{
for(i=start-1;i>=0;i--)
{
seek+=abs(req[i]-head);
head=req[i];
printf("->%d",head);
}
seek+= abs( head -0);
head = 0;
printf(" ->%d",head);
for(i=start;i%d",head);
}
}
printf("\n Total seek time:%d\n",seek);
}
int main()
{
int n,head,size,dir,i;
printf("Enter number of requets:");
scanf("%d",&n);
int req[n];
printf("Enter request queue:");
for(i=0;i<n;i++)
scanf("%d",&req[i]);
printf("Enter disk size:");
scanf("%d",&size);
printf("Enter initial head position:");
scanf("%d",&head);
printf("Enter direction (1 for right,0 for left):");
scanf("%d",&dir);
scan(req,n,head,size,dir);
return 0;
}
C-SCAN Program :
ReplyDelete#include
#include
void cscan(int req[], int n, int head, int size, int dir)
{
int seek = 0, i, j, temp, bound = size,start;
for (i = 0; i < n ; i++)
{
for (j = i + 1; j < n; j++)
{
if (req[i] > req[j])
{
temp = req[i];
req[i] = req[j];
req[j] = temp;
}
}
}
for (start = 0; start < n; start++)
{
if (req[start] >= head)
{
break;
}
}
printf("Seek sequence: %d", head);
if (dir == 1)
{
for (i = start; i < n; i++)
{
seek += abs(req[i] - head);
head = req[i];
printf(" -> %d", head);
}
seek += abs(bound - head);
head = bound;
printf(" -> %d", head);
seek += abs(bound - 0);
head = 0;
printf(" -> %d", head);
for (i = 0; i < start; i++)
{
seek += abs(req[i] - head);
head = req[i];
printf(" -> %d", head);
}
}
else
{
for (i = start - 1; i >= 0; i--)
{
seek += abs(req[i] - head);
head = req[i];
printf(" -> %d", head);
}
seek += abs(head - 0);
head = 0;
printf(" -> %d", head);
seek += abs(bound - 0);
head = bound;
printf(" -> %d", head);
for (i = n - 1; i >= start; i--)
{
seek += abs(req[i] - head);
head = req[i];
printf(" -> %d", head);
}
}
printf("\nTotal seek time: %d\n", seek);
}
int main()
{
int n, head, size, dir, i;
printf("Enter number of requests: ");
scanf("%d", &n);
int req[n];
printf("Enter request queue: ");
for (i = 0; i < n; i++)
scanf("%d", &req[i]);
printf("Enter disk size: ");
scanf("%d", &size);
printf("Enter initial head position: ");
scanf("%d", &head);
printf("Enter direction (1 for right, 0 for left): ");
scanf("%d", &dir);
cscan(req, n, head, size, dir);
return 0;
}
import pandas as pd
ReplyDeletestudents = pd.DataFrame({'Name': ['om1', 'om2', 'om3', 'om4', 'om5'],'Graduation Percentage': [85, 90, 75, 95, 80],'Age': [22, 21, 23, 20, 24]})
print("Average age of students:", students['Age'].mean())
print("Average of graduation percentage:", students['Graduation Percentage'].mean())
print(students.describe())
import pandas as pd
ReplyDeletei= pd.read_csv("D:\WT & FDS I\Revised Data Science_Workbook_ Assignment Solution\Data Science Assignment Solution\Iris.csv")
sample = i.sample(100)
print(sample.describe())
import pandas as pd
ReplyDeleteiris = pd.read_csv('D:\WT & FDS I\Revised Data Science_Workbook_ Assignment Solution\Data Science Assignment Solution\Iris.csv')
count = iris['Species'].value_counts()
print(count)
from mlxtend.preprocessing import TransactionEncoder
ReplyDeletefrom mlxtend.frequent_patterns import apriori, association_rules
import pandas as pd
# Create the dataset
data = [
['Bread', 'Milk'],
['Bread', 'Diaper', 'Beer', 'Eggs'],
['Milk', 'Diaper', 'Beer', 'Cake'],
['Bread', 'Milk', 'Diaper', 'Beer'],
['Bread', 'Milk', 'Diaper', 'Coke']
]
# Convert categorical values into numeric format
te = TransactionEncoder()
te_ary = te.fit_transform(data)
df = pd.DataFrame(te_ary, columns=te.columns_)
# Apply Apriori algorithm with min_sup=2 (at least 2 transactions)
frequent_itemsets = apriori(df, min_support=2/len(df), use_colnames=True)
rules = association_rules(frequent_itemsets, metric="confidence", min_threshold=0.7)
support_values = rules['support']
confidence_values = rules['confidence']
# Print frequent itemsets and association rules
print("Frequent Itemsets:")
print(frequent_itemsets)
print("\nconfidence Rules:")
print(support_values)