Skip to content

Instantly share code, notes, and snippets.

@LucasRibeiro36
Last active May 1, 2021 00:00
Show Gist options
  • Save LucasRibeiro36/f8a3b0e8b192e060286674c2beacc185 to your computer and use it in GitHub Desktop.
Save LucasRibeiro36/f8a3b0e8b192e060286674c2beacc185 to your computer and use it in GitHub Desktop.
//
// Created by lucas on 25/04/2021.
//
#include <stdio.h>
#include <locale.h>
int main() {
setlocale(LC_ALL, "Portuguese");
double i,s=0,auxiliar,a=0,b=1;
printf("S = 100");
for(i=0;i<=80;i+=5.0){
auxiliar = a + b;
a = b;
b = auxiliar;
if(i!=0){
s+= i/auxiliar;
printf(" + %.0f/%.0f",i,auxiliar);
} else{
printf(" + %.0f/%.0f",i,auxiliar);
}
}
printf(" = %f",s+100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment