1个回答
展开全部
#include <stdio.h>
int main(){
int a[10] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19};//集合A
int b[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};//集合B
//打印A
printf("A: ");
int i;
for(i=0; i<10; i++){
printf("%d ", a[i]);
}
printf("\n");
//打印B
printf("B: ");
for(i=0; i<10; i++){
printf("%d ", b[i]);
}
printf("\n");
//打印A\B
printf("A\\B: ");
int j;
for(i=0; i<10; i++){
for(j=0; j<10; j++){
if(a[i] == b[j])
break;
}
if(j == 10)
printf("%d ", a[i]);
}
}
int main(){
int a[10] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19};//集合A
int b[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};//集合B
//打印A
printf("A: ");
int i;
for(i=0; i<10; i++){
printf("%d ", a[i]);
}
printf("\n");
//打印B
printf("B: ");
for(i=0; i<10; i++){
printf("%d ", b[i]);
}
printf("\n");
//打印A\B
printf("A\\B: ");
int j;
for(i=0; i<10; i++){
for(j=0; j<10; j++){
if(a[i] == b[j])
break;
}
if(j == 10)
printf("%d ", a[i]);
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询