Answer to Question #303332 in C++ for zaini

Question #303332

main take two numbers as input num1 and num2. Main thread will create 2 more threads.


1. T1: Output sum of numbers from min(num1 , num2) to max(num1 , num2)


2. T2: Take a string as input and count num1 and num2 in it.

1
Expert's answer
2022-02-27T07:03:11-0500
#include <stdio.h>

#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))

int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  printf("Min=%f", min(x, y));
  printf("Max=%f", max(x, y));
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog