You are on page 1of 5

ESCUELA POLITÉCNICA DEL EJÉRCITO

SEDE LATACUNGA
NOMBRE: Cristian García

Materia: Computación

Curso: Primero “B”

FACTORIAL

#include"stdio.h"

void main()

int a,cont=1,b=1;

printf("Ingrese un numero: ");

scanf("%d",&a);

while(cont<=a)

b=b*cont;

cont++;

printf("%d",b);

PROMEDIO DE NOTAS
#include"stdio.h"

#include"math.h"

void main()

int a;

float c,b,prom;

printf("cuantos numeros va a ingresar: ");

scanf("%d",&a);

c=0;

while(c<a)

printf("ingrese las notas ");

scanf("%f",&b);

prom=prom+b;

c=c+1;

prom=prom/a;

printf("tu promedio es: %f",prom);

SUMATORIA CON EXPONENCIALES

#include"stdio.h"

#include"math.h"

void main()

{
int n,base=1,b=1,res=0,valor=0;

printf("Hasta que numero desea la sumatoria: ");

scanf("%d",&n);

while(b<=n)

res=pow(base,base+1);

valor=valor+res;

base++;

b++;

printf("La sumatoria es %d",valor);

SUMATORIA

#include"stdio.h"

void main()

int cont=1,sum=0;

while(cont<=10)

sum=sum+cont;

cont=cont+1;

printf("%d",sum);

}
SUMATORIA DE LOS NUMEROS PARES

#include"stdio.h"

void main()

int a=2,b=100,c=0;

while(a<=100)

c=c+a;

a=a+2;

printf("%d",c);

CUANTOS POSITIVOS Y CUANTOS NEGATIVOS

#include<stdio.h>

void main()

int num,cont=1,neg=0,pos=0,n;

printf("cuantos numeros va a ingresar: ");

scanf ("%d",&num);

while (cont<=num)

printf ("ingrese un numero: ");


scanf ("%d",&n);

if (n<0)

neg=neg+1;

else

pos=pos+1;

cont++;

printf ("hay %d negativos y hay %d positivos",neg,pos);

You might also like