Skip to content

Instantly share code, notes, and snippets.

@Mistat
Created July 11, 2010 13:22
Show Gist options
  • Select an option

  • Save Mistat/471550 to your computer and use it in GitHub Desktop.

Select an option

Save Mistat/471550 to your computer and use it in GitHub Desktop.
/**
* 課題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