ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Ejercicios de programacion
Nombre: Jefferson caiza
Curso: 6to ¡°d¡±

# include <iostrea.m>
# include <stdio.h>
using namespace std;

int main ()
{
        int matriz [5][5];
        int i,j;
                 for(j=0;j<5;j++)
                 {
                          for (i=0;i<5;i++)
                                   matriz [j][i]=I%2;

                 }
                                  //salida de la matriz

                 for(j=0;j<5;j++)
                          {
                          for (i=0;i<5;i++)
                          printf ("% d",matriz [j][i]);
                          printf ("n");
                          }

}
G++




           **

# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
int vect1[10];
       int x,y,aux;
       aux=0;
       for (x=0;x<=10-1;x++)
       {
                for(y=x+1;y<10-1;y++)
                {
                        if (vect1[x]<=vect1[y])
                        {
                                 aux=vect1[x];
                                 vect1[x]=vect1[y];
                                 vect1[y]=aux;
                        }
                }
       }
}




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        for(int i=1;i<=20;i++)
                 {
                         cout<<i;
                         if(i%3==0) cout<<"hola1"<<endl;
                         else cout<<"hola 2"<<endl;
                 }
                 return 0;
}
G++
# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int a,b,c;
        a=20;b=30;c=60;
        printf("n%d + %d -%d +100 = %d",a,b,c, (a+b+c-100));
}
G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int a,b;
        a=6;b=3;
        printf("(%d-%d) (%d+%d) = %d",a,b,a,b, ((a-b)*(a+b)));
}
G++
Ejercicio 8.-
CODIFICACION
# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int n,c=1,serie=5;
        printf ("cantidad de terminos:");
        scanf("%d",&n);
        while (c<=n)
        {
                 printf ("%d,",serie);
                 serie=serie+5; c++;
        }
}
G++




              

# include <iostream>
# include <stdio.h>
Using namespace std;

int main ()
{
        int a,b,c,d,e,f;
        a=14;b=2;c=30;d=10;e=23;f=5;
        int aux=a;
        if(b<aux) aux=b;
        if(c<aux) aux=c;
        if(d<aux) aux=d;
if(e<aux) aux=e;
        if(f<aux) aux=f;
        printf ("nEl valor es %d",aux);

}
G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int n,c=1;
        printf ("Ingrese Nro.:");
        scanf("%d",&n);
        int serie=n;
        while (c<=n)
        {
                 printf ("%d,",serie);
                 serie--; c++;
        }
}

G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
int numero;
        printf ("Inserte un numero de 2 digitos pares :");
        scanf( "%d",&numero);
        int aux=numero;
        if (numero<100 && numero>9)
        {
                 int d1=numero%10;
                 numero=numero/10;
                 int d2=numero%10;
                 if (d1%2==0 & d2%2==0)
                 printf ("el promedio de los digitos de %d es: %d",aux,(d1+d2)/2);
        }
                 else
                 printf ("a EROR:el digito no tiene 2 digitos");

}
g++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int numero;
        printf ("Inserte un numero de 2 digitos pares :");
        scanf( "%d",&numero);
        int aux=numero;
if (numero<100 && numero>9)
        {
                int d1=numero%10;
                numero=numero/10;
                int d2=numero%10;
                if (d1%2==0 & d2%2==0)
                printf ("el promedio de los digitos de %d es: %d",aux,(d1+d2)/2);
        }
                else
                printf ("a EROR:el digito no tiene 2 digitos");

}

G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int matriz [5][5];
        int i,j;
                 for(j=0;j<5;j++)
                 {
                          for (i=0;i<5;i++)
                                   matriz [j][i]=j%2;

                 }
                                    //salida de la matriz

                 for(j=0;j<5;j++)
                          {
for (i=0;i<5;i++)
                         printf ("% d",matriz [j][i]);
                         printf ("n");
                         }

}
G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int vector[10];
        for (int i=0;i<10;i++)
        {
                  if(i%2==0)
                          vector[i]=i%1;
                  else
                                    vector[i]=i%2;
        }
                          for (int j=0;j<10;j++)
                                     cout<<vector[j]<<endl;
}
G++




# include <iostream>
# include <stdio.h>
using namespace std;
int main ()
{
        int vector[10];
        for (int i=0;i<10;i++)
        {
                  if(i%2==0)
                          vector[i]=i%1;
                  else
                                    vector[i]=i%2;
        }
                          for (int j=0;j<10;j++)
                                     cout<<vector[j]<<endl;
}




G++




# include <iostream>
# include <stdio.h>
using namespace std;

int main ()
{
        int numero;
        printf (" ");
        scanf("%d",& numero);
        int aux=numero;
        if (numero<100 && numero>9)
        {
                 int d1=numero%10;
                 numero=numero/10;
                 int d2=numero%10;
                 if(d1%2==0 & d2%2==0)
                 printf ("el valor %d es: %d",aux,(d1+d2)/2);
}
          else
          printf ("a Mensaje Mensaje");

}
G++

More Related Content

Ejercicios de programacion

  • 1. Ejercicios de programacion Nombre: Jefferson caiza Curso: 6to ¡°d¡± # include <iostrea.m> # include <stdio.h> using namespace std; int main () { int matriz [5][5]; int i,j; for(j=0;j<5;j++) { for (i=0;i<5;i++) matriz [j][i]=I%2; } //salida de la matriz for(j=0;j<5;j++) { for (i=0;i<5;i++) printf ("% d",matriz [j][i]); printf ("n"); } } G++ ** # include <iostream> # include <stdio.h> using namespace std; int main () {
  • 2. int vect1[10]; int x,y,aux; aux=0; for (x=0;x<=10-1;x++) { for(y=x+1;y<10-1;y++) { if (vect1[x]<=vect1[y]) { aux=vect1[x]; vect1[x]=vect1[y]; vect1[y]=aux; } } } } # include <iostream> # include <stdio.h> using namespace std; int main () { for(int i=1;i<=20;i++) { cout<<i; if(i%3==0) cout<<"hola1"<<endl; else cout<<"hola 2"<<endl; } return 0; } G++
  • 3. # include <iostream> # include <stdio.h> using namespace std; int main () { int a,b,c; a=20;b=30;c=60; printf("n%d + %d -%d +100 = %d",a,b,c, (a+b+c-100)); } G++ # include <iostream> # include <stdio.h> using namespace std; int main () { int a,b; a=6;b=3; printf("(%d-%d) (%d+%d) = %d",a,b,a,b, ((a-b)*(a+b))); } G++
  • 4. Ejercicio 8.- CODIFICACION # include <iostream> # include <stdio.h> using namespace std; int main () { int n,c=1,serie=5; printf ("cantidad de terminos:"); scanf("%d",&n); while (c<=n) { printf ("%d,",serie); serie=serie+5; c++; } } G++ # include <iostream> # include <stdio.h> Using namespace std; int main () { int a,b,c,d,e,f; a=14;b=2;c=30;d=10;e=23;f=5; int aux=a; if(b<aux) aux=b; if(c<aux) aux=c; if(d<aux) aux=d;
  • 5. if(e<aux) aux=e; if(f<aux) aux=f; printf ("nEl valor es %d",aux); } G++ # include <iostream> # include <stdio.h> using namespace std; int main () { int n,c=1; printf ("Ingrese Nro.:"); scanf("%d",&n); int serie=n; while (c<=n) { printf ("%d,",serie); serie--; c++; } } G++ # include <iostream> # include <stdio.h> using namespace std; int main () {
  • 6. int numero; printf ("Inserte un numero de 2 digitos pares :"); scanf( "%d",&numero); int aux=numero; if (numero<100 && numero>9) { int d1=numero%10; numero=numero/10; int d2=numero%10; if (d1%2==0 & d2%2==0) printf ("el promedio de los digitos de %d es: %d",aux,(d1+d2)/2); } else printf ("a EROR:el digito no tiene 2 digitos"); } g++ # include <iostream> # include <stdio.h> using namespace std; int main () { int numero; printf ("Inserte un numero de 2 digitos pares :"); scanf( "%d",&numero); int aux=numero;
  • 7. if (numero<100 && numero>9) { int d1=numero%10; numero=numero/10; int d2=numero%10; if (d1%2==0 & d2%2==0) printf ("el promedio de los digitos de %d es: %d",aux,(d1+d2)/2); } else printf ("a EROR:el digito no tiene 2 digitos"); } G++ # include <iostream> # include <stdio.h> using namespace std; int main () { int matriz [5][5]; int i,j; for(j=0;j<5;j++) { for (i=0;i<5;i++) matriz [j][i]=j%2; } //salida de la matriz for(j=0;j<5;j++) {
  • 8. for (i=0;i<5;i++) printf ("% d",matriz [j][i]); printf ("n"); } } G++ # include <iostream> # include <stdio.h> using namespace std; int main () { int vector[10]; for (int i=0;i<10;i++) { if(i%2==0) vector[i]=i%1; else vector[i]=i%2; } for (int j=0;j<10;j++) cout<<vector[j]<<endl; } G++ # include <iostream> # include <stdio.h> using namespace std;
  • 9. int main () { int vector[10]; for (int i=0;i<10;i++) { if(i%2==0) vector[i]=i%1; else vector[i]=i%2; } for (int j=0;j<10;j++) cout<<vector[j]<<endl; } G++ # include <iostream> # include <stdio.h> using namespace std; int main () { int numero; printf (" "); scanf("%d",& numero); int aux=numero; if (numero<100 && numero>9) { int d1=numero%10; numero=numero/10; int d2=numero%10; if(d1%2==0 & d2%2==0) printf ("el valor %d es: %d",aux,(d1+d2)/2);
  • 10. } else printf ("a Mensaje Mensaje"); } G++