#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("This is my first c program!");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("********************\nVery Good!\n********************");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=123;
int b=456;
int sum;
sum = a+b;
printf("sum=%d", sum);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b;
scanf("%d%d", &a, &b);
printf("%d", a+b);
return 0;
}
本题涉及的一元二次方程求根公式为:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
double a,b,c, r1, r2, temp;
scanf("%lf%lf%lf", &a, &b, &c);
temp = pow(b, 2.0) - 4*a*c;
if(a!=0 && temp > 0)
{
r1 = (-b+sqrt(temp))/2*a;
r2 = (-b-sqrt(temp))/2*a;
}
else{
return 0;
}
printf("r1=%7.2f\n", r1);
printf("r2=%7.2f", r2);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
char arr[3];
scanf("%s", arr);
printf("%s\n", arr);
return 0;
}