Created
December 7, 2015 17:58
-
-
Save mikekavouras/7c531f078c3c000df27d 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
| #include <stdio.h> | |
| #include <math.h> | |
| int main() | |
| { | |
| float pi = 3.141592; | |
| float i; | |
| float bulb1; | |
| float bulb2; | |
| float bulb3; | |
| int bulbs_num; | |
| float offset; | |
| bulbs_num = 3; | |
| offset = 100/bulbs_num; | |
| for (i = 0; i < 2 * pi;i = i + pi/10 ){ | |
| bulb1 = (sin(i-(pi/2)) + 1) * 50; | |
| bulb2 = (sin((i + offset)-(pi/2)) + 1) * 50; | |
| bulb3 = (sin((i + 2 * offset)-(pi/2)) + 1) * 50; | |
| printf("Bulb One Brightness: "); | |
| printf("%9.6f", bulb1); | |
| printf("\n"); | |
| printf("Bulb Two Brightness: "); | |
| printf("%9.6f", bulb2); | |
| printf("\n"); | |
| printf("Bulb Three Brightness: "); | |
| printf("%9.6f", bulb3); | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment