QI: Write a C code to perform vector arithmetic: Define 3 vectors A[100], B[100],[100]. Get n from the user, and create

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

QI: Write a C code to perform vector arithmetic: Define 3 vectors A[100], B[100],[100]. Get n from the user, and create

Post by answerhappygod »

Qi Write A C Code To Perform Vector Arithmetic Define 3 Vectors A 100 B 100 100 Get N From The User And Create 1
Qi Write A C Code To Perform Vector Arithmetic Define 3 Vectors A 100 B 100 100 Get N From The User And Create 1 (58.93 KiB) Viewed 47 times
c code
vmwear
linux
QI: Write a C code to perform vector arithmetic: Define 3 vectors A[100], B[100],[100]. Get n from the user, and create n processes. (n will be one of Divisors of 100). Get operation from user: add, sub. Each process will perform the operation on a chunk of the vector, for example, if n=10, cach process will add sub 10 elements. Use exec to run the add or sub programs Parent should print A,B,C in a file. (vourname.txt) For example, n=10, operation=sub Partition work equally to each process: pO executes A[0-9] =B[0-9]-C [0:9] pl executes A[10:19] = B[10:19]-C [10:19] and so on. no synchronization is required For example, the output will be like this B[100]={1,2,3,4,3,2,3,3,...etc..) C(100)=(4,29,4,1,2,3,3,....etc..) Enter number of process: 10 Enter the Operation for Add enter 1 for Sub enter 2:2 10 processes created Parent process print A,B,C in. (Ahmad.txt) Notes: You have one weeks to submit this sheet. Submit only the code file a notepad file (yourname.c file) only. Submission will be on Moodle. Late Submission will be ignored. • Work individually.(not groups). In the first line write your names as a comments.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply