周五练习10
作者:互联网
#include<stdio.h>
#include<stdlib.h>
void main(){
int i = 10, j = 0;
do{
j = j + i; i--;
} while (i > 2);
printf("%d\n", j);
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
void main(){
int a = 3, b = 4, c = 5, t = 99;
if (b < a&&a < c)t = a; a = c; c = t;
if (a>c&&b < c)t = b; b = a; a = t;
printf("a=%d,b=%d,c=%d\n", a, b, c);
system("pause");
return 0;
}
#include<stdlib.h>
void main(){
int a = 0;
a += (a = 8);
printf("%d\n", a);
return 0; } #include<stdio.h>
#include<stdlib.h>
void main(){
int a = 0, i;
for (i = 1; i < 5; i++){
switch (i){
case 0:
case 3:a += 2;
case 1:
case 2:a += 3;
default:a += 5;
}
}
printf("%d\n", a);
system("pause");
return 0;
} #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>//打印※号图案
#include<stdlib.h>
void main(){
int i, j, n;
printf("input n(<=10):");
scanf("%d", &n);
for (i = 1; i <= n; i++){
for (j = 1; j <= n - i; j++)
printf(" ");
for (j = 1; j <= 2 * i - 1; j++)
printf("*");
printf("\n");
}
for (i = n - 1; i >=1; i--){
for (j = 1; j <= n - i; j++)
printf(" ");
for (j = 1; j <= 2 * i - 1; j++)
printf("*");
printf("\n");
}
system("pause");
return 0;
} #include<stdio.h>//找数字
#include<stdlib.h>
int main(){
int a, b, c;
for (a = 0; a <= 30; a++)
for (b = 0; b <= 30; b++){
c = 30 - a - b;
if (a + 2 * b + 4 * c ==88 && 2 * (a + b) - 3 * c == -15)
printf("a=%d,b=%d,c=%d", a, b, c);
}
system("pause");
return 0;
} #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int a;
int i;
int prime(int x){
for (i = 2; i<x; i++){
if (x%i == 0)
return 0;
}
return 1;
}
int main()
{
scanf("%d", &a);
if (prime(a) == 1)
printf("不是素数\n");
else
printf("是素数\n");
system("pause");
return 0;
}
标签:10,pause,return,int,练习,system,周五,printf,main 来源: https://www.cnblogs.com/yuzhenghan/p/11914371.html