Q1)
#include <stdio.h>
void getArray(int set1[10],int set2[10]){
int i;
printf("Enter the elements of set 1:");
for (i = 0; i <10; i++) {
scanf("%d",&set1[i]);
printf("Enter the elements of set 2:");
for (i = 0; i <10; i++) {
scanf("%d",&set2[i]);
int findintersection(int set1[10],int set2[10],int intersection[10]){
int i, j,numintvalues=0;
for (i=0;i<10; i++){
for (j = 0;j<10; j++){
if (set1[i]==set2[j]){
intersection[numintvalues]=set1[i];
numintvalues=numintvalues+1;
break;
return numintvalues;
void displayintvalue(int intersection[10],int numintvalues){
int i;
if(numintvalues>0){
printf("the intersection elements are the following:");
for(i=0;i<numintvalues;i++){
printf("%d ",intersection[i]);
}}
else{
printf("there is no intersection\n");
main() {
int i, j,intersection[10],numintvalues;
int set1[10],set2[10];
getArray(set1,set2);
numintvalues=findintersection(set1,set2,intersection);
displayintvalue(intersection,numintvalues);
Q2)
#include<stdio.h>
main()
int limit,i,j=0,sum=0,count=0;
printf("enter the limit value:");
scanf("%d",&limit);
if(limit>=10 && limit<=150){
printf("all nbrs divisible by 3 and 5:");
for(i=1;i<=limit;i++){
if(i%3==0 && i%5==0 ){
printf("%d ",i);
printf("\nall nbrs divisible by either 3 or 5:");
for(i=1;i<limit;i++){
if(i%3==0 ^ i%5==0){
printf("%d ",i);
sum=sum+i;
printf("\nsum of nbrs divisible by either 3 or 5 is %d",sum);
printf("\nthe numbers which are not divisible by 3 and 5:");
for(i=1;i<limit;i++){
if(i%3!=0 && i%5!=0){
printf("%d ",i);
count=count+i;
printf("\nthe sum of nbrs not divisible by 3 and 5 is:%d",count);
else{
printf("\nyour limit is not in the range of 10 and 150");