#include <stdio.h>
int main() {
int number, max, min, n; n=;
printf("请输入%d个数: ", n);
scanf("%d", &number); max = number;
min = number; while(n<=) {
n++;
printf("请输入第%d个数: ", n);
scanf("%d", &number); if(number>max)
max = number;
else if(number<min)
min = number;
} printf("最大数为: %d\n", max);
printf("最小数为: %d\n", min); return ;
}

experiment 3-LMLPHP

#include <stdio.h>
int main()
{
int i = ;
int j = ;
for (i = ; i <=; i+=)
{
for (j = ; j<=i; j++)
{
if ( == i%j)
{
break;
}
}
if (j == i)
printf("%d ",i);
} return ;
}

experiment 3-LMLPHP

#include <stdio.h>
int trangle(int n)
{
int i,j;
for(i = ;i<n;i++)
{
for(j = ;j<=n-i;j++)
putchar(' ');
for(j = ;j<=*i;j++)
putchar('*');
putchar('\n');
}
return ;
} int main()
{
int n;printf("Enter n:");
scanf("%d",&n);
printf("\n");
trangle(n);
return ;
}

experiment 3-LMLPHP

part 1 answer:

1.

break语句:用于永久终止循环

continue语句:用于终止本次循环

2.

均不影响

05-11 13:25