C program to create two sets and print the difference of the sets, explain plzz ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C program to create two sets and print the difference of the sets, explain plzz ??

In (A - B) form

18th Oct 2021, 5:13 AM
Demon Wisdomm
4 Answers
+ 2
Make your question more descriptive. What sets? There are no standard library sets in C. What you're talking about?
18th Oct 2021, 5:14 AM
Rishi
Rishi - avatar
+ 1
Okay now it's good. Show your attempt. We don't just give answers to questions, show your attempt and tell where you went wrong. Hint: This question can be approached by using arrays. Get in the length of two sets, create arrays of that size and get the sets as input. Then create a function that takes in the two sets (arrays) and returns a new set (array) with the elements in A but not in B
18th Oct 2021, 5:44 AM
Rishi
Rishi - avatar
0
You can use array as a sets if u want that your array doesn't consists duplicate elements then u can use any method to remove duplicate method . Take two array first one for set1 second one for set2 I suppose there is no duplicate elements . Then u need to use two loop for i to ....n for j to ..n //here in if condition u can write like this if(set1[i]==set2[j]) put values here one by one u will understood better Then print Esle continue; NOTE : first try on pen paper
18th Oct 2021, 7:19 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
https://code.sololearn.com/cy3lirStMq3z/?ref=app This code is providing A-B B-A and SYMMETRIC DIFFERENCE ALL THE 3 ASPECTS
20th Oct 2021, 11:59 AM
sree harsha
sree harsha - avatar