Skip to content

Instantly share code, notes, and snippets.

@mactkg
Created September 17, 2011 13:24
Show Gist options
  • Save mactkg/1223929 to your computer and use it in GitHub Desktop.
Save mactkg/1223929 to your computer and use it in GitHub Desktop.
#include<math.h>
#include<stdio.h>
void main(){
int i,times,vo,vi;
printf("please input Vi\n");
scanf("%d", &vi);
times = 1;
for(i = 0; i < 4; i++) {
times = times*10;
printf("3*%d:",times);
scanf("%d", &vo);
printf("result:%lf\n\n", 20*log10((double)vo/vi));
printf("5*%d:",times);
scanf("%d", &vo);
printf("result:%lf\n\n", 20*log10((double)vo/vi));
printf("7*%d:",times);
scanf("%d", &vo);
printf("result:%lf\n\n", 20*log10((double)vo/vi));
printf("10*%d:",times);
scanf("%d", &vo);
printf("result:%lf\n\n", 20*log10((double)vo/vi));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment