Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************
- * Author : Diego Cordoba / @d1cor *
- * Purpose : juncotic.com @juncotic *
- *******************************************/
- #include <stdio.h>
- int posicion(int *v, int dato){
- int i=0, flg=0;;
- for (i = 0; i < 20; i++) {
- if(*(v+i)==dato){
- printf("%d encontrado en la posicion %d\n", dato, i);
- flg++;
- }
- }
- if(!flg) printf("%d No existe\n");
- }
- int main(int argc, const char *argv[]){
- int v[200];
- int i,j,k,l;
- int fib=1;
- int datos[20]={1,2,1,4,5,3,6,4,7,8,3,5,3,7,9,2,1,4,5,6};
- i=j=k=l=0;
- printf("ej1\n");
- for(i=1,j=100;i<100;i++, j--){
- printf("%d %d ", j, i);
- }
- printf("ej2\n");
- j=0;
- k=1;
- printf("ej2\n\n");
- for (i = 1, j=1, k=0; i < 50; i++) {
- if(i%2){
- j = k;
- k = fib;
- fib = j+k;
- printf("%d ",fib);
- }else{
- printf("%d ", 3*l++);
- }
- }
- printf("ej3\n");
- posicion(datos,3);
- posicion(datos,1);
- posicion(datos,10);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement