Created
July 11, 2010 13:22
-
-
Save Mistat/471550 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 課題3 | |
| * | |
| * 実数xをキーボードから入力し、a[0]=1,a[1]=2,a[2]=3として | |
| * y=a[0]x^2+a[1]x+a[2]を 計算し、yを出力するプログラム | |
| */ | |
| #include <stdio.h> | |
| #include <math.h> | |
| int main(int argc, char** argv) { | |
| int a[] = {1,2,3}; | |
| float x, y; | |
| scanf("%f", &x); | |
| y = a[0] * pow(x, 2) + a[1] * x + a[2]; | |
| printf("%f\n", y); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment