Escolar Documentos
Profissional Documentos
Cultura Documentos
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int f1=1, f2=1;
printf("0\n1\n",f1);
while(f1<10000) {
printf("%d\n",f2);
f2+=f1;
f1=f2-f1;
}
system("PAUSE");
return 0;
}
Fibonacci b:
#include <stdio.h>
#include <stdlib.h>
int main(void)
int x,y,z,cont;
x=0;
y=1;
printf("0\n1\n",z);
for (cont=1;cont<=50;cont=cont+1)
z=x+y;
printf("%d\n",z);
x=y;
y=z;
system("PAUSE");
return 0;
}
1.. introduce dos nmeros y los sumas y pregunta.
#include <stdio.h>
#include <stdlib.h>
int main(void)
char op;
do{
system("cls");
n1=n1+n2;
printf("\nResultado %d",n1);
fflush( stdin );
return 0;
}
2.imprime n nmeros enteros
#include <stdio.h>
#include <stdlib.h>
int main(void)
int i,s=0,n;
for(i=1;i<=n;i++) {
s=s+i;
printf("\nResultado %d",s);
system("pause");
return 0;
}
1. Potencia de 4
#include <stdio.h>
#include <math.h>
int main(){
int sum=0,pot;
int i,c=0;
while(c<=30){
c++;
pot=pow(4, c);
printf("\nPotencia %d",pot);
return 0;
}
2.. pide 5 numeros y busca el cuadrado y el cubo
#include <stdio.h>
#include <math.h>
int main(){
int n1,n2, i;
for(i=1;i<=5;i++){
n1=pow(n1, 2);
n2=pow(n2, 3);
printf("\nPotencia %d",);
}
return 0;