//shiyanyi
#include <math.h>
#include <stdio.h>
int main() {
float a, b, c, x1, x2;
float delta, real, imag;
printf("Enter a, b, c: ");
while(scanf("%f%f%f", &a, &b, &c) != EOF) {
if(a == 0)
printf("not quadratic equation.\n\n");
else {
delta = b*b - 4*a*c;
if(delta >= 0) {
x1 = (-b + sqrt(delta)) / (2*a);
x2 = (-b - sqrt(delta)) / (2*a);
printf("x1 = %.2f, x2 = %.2f\n\n", x1, x2);
}
else {
real = -b/(2*a);
imag = sqrt(-delta) / (2*a);
printf("x1 = %.2f + %.2fi, x2 = %.2f - %.2fi\n\n", real,
imag, real, imag);
}
}
printf("Enter a, b, c: ");
}
return 0;
}
![]()
//shiyaner
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 5
int main() {
int x, n;
srand(time(0));
n = 0;
do {
n++;
x = rand()%10;
printf("%3d", x);
}while(n<N);
printf("\n");
return 0;
}
![]()
//shiyansan
#include<math.h>
int main()
{
int i,sum,n,m;
i=0;
for(n=101;n<=200;n++)
{
for(i=2;i<=sqrt(n);++i)
if(n%i==0)break;
if(i>sqrt(n))
{
printf("%d\t",n);
sum=sum+1;
if(sum%5==0)
printf("\n");
}
printf("101~200");
printf("101^200之间共有%d个素数",sum);
return 0;
![]()
//shiyansi
#include<stdio.h>
int main()
{
int x, y, v, d;
d = 1;
v = 0;
printf("Enter a number:");
while (scanf("%d", &y) != EOF) {
while (y>= 1)
{
x = y % 10;
y = y / 10;
if (x % 2 != 0)
{
v = v+x * d;
d = d * 10;
}
}
printf("Enter a new number :%d\n", v);
v = 0;
d = 1;
printf("Enter a number:");
}
return 0;
![]()
//shiyanwu
#include<stido.h>
int main() {
int n,d,c;
float a,b;
a = 0;
b = 1;
c = 1;
d = 1;
printf("Enter n(0`10):");
while(scanf("%d", &n) != EOF) {
for (; d <= n; d++)
{
c = (-1) * c * a;
a = a - b / c;
}
printf("n=%d, s=%f\n\n", c, a);
printf("Enter n(0`10):");
}
return 0;}
![]()
//shiyanliu
#include<stdlib.h>
#include<time.h>
int main()
{
int x, y, c, z;
srand(time(0));
x = (rand() % 31 + 1);
printf("猜猜2020年12月哪一天是你的luck day\n\n");
printf("开始咯,你有三次机会,猜吧(1~31):");
scanf("%d", &x);
printf("\n\n");
if (y == x)
{
printf("luck day");}
else if (y < x)
{
printf("你猜的日期早了,luck day还没到呢");
}
else if (y > x)
{
printf("你猜的日期晚了,luck day悄悄溜到前面啦");
}
printf("再猜(1~31:)");
scanf("%d", &c);
printf("\n");
if (c == x)
{
printf("luck day");
}
else if (c < x){
printf("你猜的日期早了,luck day还没到呢");
}
else if (c > x)
{
printf("你猜的日期晚了,luck day悄悄溜到前面啦");
}
printf("再猜(1~31:)");
scanf("%d", z);
printf("\n\n");
if (z == x)
{
printf("luck day");
}
else if (z < x)
![]()