This C program uses functions to perform operations on complex numbers represented as a structure with real and imaginary parts. It takes user input for two complex numbers, performs either addition or multiplication based on the user's selection, and displays the result. The main menu allows the user to choose addition or multiplication and calls the arithmetic function accordingly, which contains the code to perform the operation and display the output.
Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output
Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output
Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output
Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdfabdulrahamanbags
Q1 Consider the below omp_trap1.c implantation, modify the code so that: i. The time used by
the parallel block is timed using the OpenMP function omp_get_wtime(). The syntax is double
omp_get_wtime ( void ) It returns the number of seconds that have elapsed since some time in
the past. ii. Now on a system with at least two cores, time the program with a. one thread and a
large value of n, and b. two threads and the same value of n. Explain what happens? Then Do the
same measurements for the omp_trap2.c code.
1. How does its performance compare with the performance of the omp_trap1.c ?
2. Explain your answers.
3. provide with your answers the code and detailed screenshots showing how did you compile
and run the code and times for each run:
/* File: omp_trap1.c * Purpose: Estimate definite integral (or area under curve) using trapezoidal
rule. * Input: a, b, n * Output: estimate of integral from a to b of f(x) * using n trapezoids. * *
Compile: gcc -g -Wall -fopenmp -o omp_trap1 omp_trap1.c * Usage: ./omp_trap1 * * Notes: *
1. The function f(x) is hardwired. * 2. In this version, each thread explicitly computes the
integral over its assigned subinterval, a critical directive is used for the global sum. * 3. This
version assumes that n is evenly divisible by the number of threads #include #include #include
#include void Usage(char* prog_name); double f(double x); /* Function we're integrating */
double Local_trap ( double a , double b , i n t n ) ; int main(int argc, char* argv[]) { double
global_result = 0.0; /* Store result in global_result */ double a, b; /* Left and right endpoints */
int n; /* Total number of trapezoids */ int thread_count; if (argc != 2) Usage(argv[0]);
thread_count = strtol(argv[1], NULL, 10); printf("Enter a, b, and n\n"); scanf("%lf %lf %d", &a,
&b, &n); if (n % thread_count != 0) Usage(argv[0]); double global_result = 0.0; # pragma omp p
a r a l l e l num_threads ( t h r e a d _ c o u n t ) { # pragma omp c r i t i c a l global_result +=
Local_trap ( double a , double b , i n t n ) ; } printf("With n = %d trapezoids, our estimate\n", n);
printf("of the integral from %f to %f = %.14e\n", a, b, global_result); return 0; } /* main */ /*----
---------------------------------------------------------------- * Function: Usage * Purpose: Print
command line for function and terminate * In arg: prog_name */ void Usage(char* prog_name) {
fprintf(stderr, "usage: %s \n", prog_name); fprintf(stderr, " number of trapezoids must be evenly
divisible by\n"); fprintf(stderr, " number of threads\n"); exit(0); } /* Usage */ /*---------------------
--------------------------------------------- * Function: f * Purpose: Compute value of function to be
integrated * Input arg: x * Return val: f(x) */ double f(double x) { double return_val; return_val
= x*x; return return_val; } /* f */ /*------------------------------------------------------------------ *
Function: Trap * Purpose: Use trapezoidal rule to estimate definite integral * Input args.
hey this is Rupendra choudhary..!! i shared my "c" lang ppt..!!! u just goto that ppt if u r in deep with "c" ..!!! i create after i hv played a much with "c"..(sorry bt ppt is slightly disturbd may be due to unsupportable msppt2010 by slideshare)...find me on rupendrachoudhary1990@gmail.com or https://rupendrachoudhary.wordpress.com
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
2024.06.01 Introducing a competency framework for languag learning materials ...
week-11x
1. /* Write a C program that uses functions to perform the following operations:
i) Reading a complex number
ii) Writing a complex number
iii) Addition of two complex numbers
iv) Multiplication of two complex numbers
(Note: represent complex number using a structure.) */
#include<stdio.h>
#include<math.h>
void arithmetic(int opern);
struct comp
{
double realpart;
double imgpart;
};
void main()
{
int opern;
clrscr();
printf("nn ttt***** MAIN MENU *****");
printf("nn Select your option: n 1 : ADDn 2 : MULTIPLYn 0 : EXIT nntt Enter your Option
[ ]bb");
2. scanf("%d",&opern);
switch(opern)
{
case 0:
exit(0);
case 1:
case 2:
arithmetic(opern);
default:
main();
}
}
void arithmetic(int opern)
{
struct comp w1, w2, w;
printf("n Enter two Complex Numbers (x+iy):n Real Part of First Number:");
scanf("%lf",&w1.realpart);
printf("n Imaginary Part of First Number:");
3. scanf("%lf",&w1.imgpart);
printf("n Real Part of Second Number:");
scanf("%lf",&w2.realpart);
printf("n Imaginary Part of Second Number:");
scanf("%lf",&w2.imgpart);
switch(opern)
{
/*addition of complex number*/
case 1:
w.realpart = w1.realpart+w2.realpart;
w.imgpart = w1.imgpart+w2.imgpart;
break;
/*multiplication of complex number*/
case 2:
w.realpart=(w1.realpart*w2.realpart)-(w1.imgpart*w2.imgpart);
w.imgpart=(w1.realpart*w2.imgpart)+(w1.imgpart*w2.realpart);
break;
}