ESTE PROGRAMA IMPRIME UN NUMERO SI ES POSITIVO O ES NEGATIVO, CON LA ESTRUCTURA IF ELSE.
/*Programa*/
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int a;
gotoxy(12,25);printf("El numero es: ");
scanf("%d",&a);
if(a>0)
{
gotoxy(14,25);printf("El numero %d es positivo",a);
}
else
{
gotoxy(14,25);printf("El numero %d es negativo",a);
}
getche();
return(0);
}
PROGRAMA QUE IMPRIME ELNOMBRE DEL ALUMNO, TRES CALIFICACIONES Y APARTIR DE LOS DATOS DADOS CALCULAR EL PROMEDIO GENERAL E IMPRIMIR SI ES APROBADO O REPROBADO, CON LA ESTRUCTURA IF ELSE.
/*Calificacion final*/
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int c,c1,c2,pr;
char nombre[30];
gotoxy(10,8);printf("Dame tu segunda calificacion: ");
scanf("%f",&c1);
gotoxy(10,10);printf("Dame tu tercera calificacion:");
scanf("%f",&c2);
pr=(c+c1+c2)/3;
if(pr>6)
{
gotoxy(10,10);printf("Esta %f aprobado",pr);
}
else
{
gotoxy(10,10);printf("Esta %f reprobado",pr);
}
getche();
return(0);
}
ESTE PROGRAMA CALCULA EL IVA Y PRESIO NETO E IMPRIME EL NOMBRE DEL PRODUCTO Y SU PRECIO NETO, SIN NINGUNA ESTRUCTURA.
/*Producto y precio*/
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
float pn,iva,pp;
char Np[20];
gotoxy(15,2);printf("Dame el nombre del producto: ");
scanf("%s",&Np);
gotoxy(12,4);printf("Introduce el precio del producto: ");
scanf("%f",&pp);
iva=pp*0.5;
pn=pp+iva;
gotoxy(15,6);printf("El nombre del producto es: %s",Np);
gotoxy(15,8);printf("El precio neto es %.2f",pn);
getche();
return(0);
}
ESTE PROGRAMA IMPRIME EL SALARIO QUINCENAL, HORAS EXTRAS E IMPRIME EL NOMBRE DEL TRABAJADOR Y SU SALARIO NETO, SIN NINGUNA ESTRUCTURA.
/*Trabajo y salario*/
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
float sn,sq,hex,sd,sh,phex,h;
char trabj[30];
gotoxy(15,2);printf("Dame tu nombre: ");
scanf("%s",&trabj);
gotoxy(15,4);printf("Introduce el salario quincenal: ");
scanf("%f",&sq);
gotoxy(15,6);printf("Introduce las horas extras: ");
scanf("%f",&hex);
sd=sq/15;
sh=sd/8;
hex=sh*h;
phex=(sh*hex)*2;
sn=sq+phex;
gotoxy(15,8);printf("El nombre del trabajador es: %s",trabj);
gotoxy(15,10);printf("El salario neto es %.2f",sn);
getche();
return(0);
}
ESTE PROGRAMA IMPRIME LA SERIE DEL 1 AL 10, CON LA ESTRUCTURA FOR.
/*Serie1*/
#include<stdio.h>
#include<conio.h>
main()
{
int se1,r,l;
clrscr();
l=10;
gotoxy(10,8);printf("Serie del 1-10");
for(r=0;r<=10;r++)
{
se1=r+1;
gotoxy(10,l);printf("%d",se1);
l++;
}
getch();
return(0);
}
ESTE PROGRAMA IMPRIME LOS PARES DEL 2 AL 20, CON LA ESTRUCTURA FOR.
/*Pares*/
#include<stdio.h>
#include<conio.h>
main()
{
int pr,s,l;
clrscr();
l=5;
gotoxy(10,3);printf("Pares del 2-20");
for(s=0;s<=20;s+=2)
{
pr=s+2;
gotoxy(10,l);printf("%d",pr);
l++;
}
getche();
return(0);
}
ESTE PROGRAMA IMPRIME LOS MULTIPLOS DEL 7 AL 50, CON LA ESTRUCTURA FOR.
/*Multiplos*/
#include<stdio.h>
#include<conio.h>
main()
{
int mp,s,l;
clrscr();
l=3;
gotoxy(10,1);printf("Multiplos del 7-50");
for(mp=0;mp<=50;mp+=7)
{
s=mp+7;
gotoxy(10,l);printf("%d",s);
l++;
}
getche();
return(0);
}
ESTE PROGRAMA IMPRIME LA SERIE DEL 0.5 AL 10, CON LA ESTRUCTURA FOR.
/*Serie2*/
#include<stdio.h>
#include<conio.h>
main()
{
float sr2,e,l;
clrscr();
l=6;
gotoxy(10,4);printf("Serie del 0.5-10");
for(e=0;e<=10;e+=0.5)
{
sr2=e+0.5;
gotoxy(10,l);printf("%.2f",sr2);
l++;
}
getche();
return(0);
}
ESTE PROGRAMA IMPRIME LOS IMPARES DEL 1 AL 19, CON LA ESTRUCTURA FOR.
/*Impares*/
#include<stdio.h>
#include<conio.h>
main()
{
int z,m,l;
clrscr();
l=5;
gotoxy(30,2);printf("Impares del 1-19");
for(m=1;m<=10;m++)
{
z=(m*2)-1;
gotoxy(30,l);printf("%d",z);
l++;
}
getch();
return(0);
}
ESTE PROGRAMA IMPRIME LOS PARES DEL 30 AL 2, CON LA ESTRUCTURA FOR.
/*Par30*/
#include<stdio.h>
#include<conio.h>
main()
{
int pr,r,l;
clrscr();
l=4;
gotoxy(30,2);printf("Pares del 30-2");
for(r=15;r<=1;r--)
{
pr=r*2;
gotoxy(30,l);printf("%d",pr);
l++;
}
getch();
return(0);
}
ESTE PROGRAMA IMPRIME UNA TABLA DE MULTIPLICAR CUALQUIERA, CON LA ESTRUCTURA FOR.
/*Tabla Multiplicar*/
#include<stdio.h>
#include<conio.h>
main()
{
int t,c,r,l;
clrscr();
l=5;
gotoxy(5,2);printf("Dame la tabla de multiplicar: ");
scanf("%d",&t);
for(c=1;c<=10;c++)
{
r=c*t;
gotoxy(7,l);printf("%d*%d=%d",t,c,r);
l++;
}
getch();
return(0);
}
ESTE PROGRAMA ES UN EJEMPLO CON LA ESTRUCTURA WHILE QUE IMPRIME LA SERIE DEL 1 AL 10.
/*Programa2*/
#include<stdio.h>
#include<conio.h>
main()
{
int m,l;
clrscr();
m=1;
l=5;
gotoxy(30,2);printf("Serie while 1-10");
while(m<=10)
{
gotoxy(34,l);printf("%d",m);
m++;
l++;
}
getch();
return(0);
}
ESTE PRIGRAMA IMPRIME LOS PARES COMPRENDIDOS ENTRE 20 AL 60, CON LA ESTRUCTURA WHILE.
/*Pares60*/
#include<stdio.h>
#include<conio.h>
main()
{
int r,l;
clrscr();
l=3;
r=20;
gotoxy(5,1);printf("Pares entre 20-60");
while(r<=60)
{
gotoxy(7,l);printf("%d",r);
r+=2;
l++;
}
getch();
return(0);
}
ESTE PROGRMAMA IMPRIME LOS IMPARES DEL 1 AL 30, CON LA ESTRUCTURA WHILE.
/*Impares30*/
#include<stdio.h>
#include<conio.h>
main()
{
int re,I,l;
clrscr();
l=4;
re=1;
gotoxy(8,2);printf("Impares del 1-30");
while(I<=30)
{
I=(re*2)-1;
gotoxy(10,l);printf("%d",I);
re++;
l++;
}
getch();
return(0);
}
ESTE PROGRAMA IMPRIME UNA TABLA DE MULTIPLICAR CUALQUIERA, CON LA ESTRUCTURA WHILE.
/*Tabla Multiplicar1*/
#include<stdio.h>
#include<conio.h>
main()
{
int tb,mt,bt,l;
clrscr();
l=3;
tb=1;
gotoxy(10,1);printf("Digita la tabla de multiplicar: ");
scanf("%d",&bt);
while(tb<=10)
{
mt=tb*bt;
gotoxy(12,l);printf("%d*%d=%d",bt,tb,mt);
tb++;
l++;
}
getch();
return(0);
}
ESTE PROGRAMA ES DE UN PROBLEMA DE UNA TAQUERIA QUE SE TIENE QUE RESOLVER CON LA ESTRUCTURA WHILE QUE DICE LO SIGUIENTE:
LA TAQUERIA “LOS MOLCAGETES” NECESITA UN PROGRAMA QUE LE PERMITA REALIZAR EL COBRO A LOS CLIENTES SOBRE SU CONSUMO. GENERAR TABLA PARA HASTA n TACOS, TOMANDO EN CUENTA QUE CADA TACO CUESTA $3.60.
/*Tacos*/
#include<stdio.h>
#include<conio.h>
main()
{
int b,c,l;
float d;
clrscr();
l=11;
c=1;
gotoxy(30,2);printf("Dame la cantidad de tacos: ");
scanf("%d",&b);
while(c<=b)
{
d=c*3.60;
gotoxy(34,5);printf("\"Tacos Los Molcajetes\"");
gotoxy(38,9);printf("\"Tacos\"");
gotoxy(49,9);printf("\"Total\"");
gotoxy(39,l);printf("%d",c);
gotoxy(49,l);printf("%.2f",d);
c++;
l++;
}
getch();
return(0);
}
ESTE PROGRAMA IMPRIME LOS IMPARES COMPRENDIDOS ENTRE 1 AL 99, CON LA ESTRUCTURA DO WHILE.
/*Impares99*/
#include<stdio.h>
#include<conio.h>
main()
{
int Ip,pi,l;
clrscr();
l=3;
pi=1;
gotoxy(10,1);printf("Impares entre 1-99");
do
{
Ip=(pi*2)-1;
gotoxy(10,l);printf("%d",Ip);
pi++;
l++;
}
while(Ip<=50);
getch();
return(0);
}
ESTE PROGRAMA IMPRIME LA SUMA DE LA SERIE DE NUMEROS PARES COMPRENDIDOS ENTRE 2 AL 30, CON LA ESTRUCTURA DO WHILE.
/*Suma Pares30*/
#include<stdio.h>
#include<conio.h>
main()
{
int Sp,pr,ms,l;
clrscr();
l=6;
ms=1;
Sp=0;
gotoxy(5,2);printf("Suma pares entre 2-30");
do
{
pr=ms*2;
Sp=Sp+pr;
gotoxy(5,4);printf("Pares");
gotoxy(15,4);printf("Suma Pares");
gotoxy(5,l);printf("%d",pr);
gotoxy(20,l);printf("%d",Sp);
ms++;
l++;
}
while(pr<=30);
getch();
return(0);
}
ESTE PROGRAMA ES UN EJEMPLO QUE IMPRIME LA SUMA DE PARES COMPRENDIDOS ENTRE 1 AL 10, CON LA ESTRUCTURA DO WHILE.
/*Programa3*/
#include<stdio.h>
#include<conio.h>
main()
{
int c,suma,aux,l;
clrscr();
l=5;
c=1;
suma=0;
gotoxy(30,1);printf("Suma pares");
do
{
aux=c*2;
suma=suma+aux;
gotoxy(30,2);printf("C");
gotoxy(40,2);printf("Suma");
gotoxy(32,l);printf("%d",aux);
gotoxy(42,l);printf("%d",suma);
c++;
l++;
}
while(c<=10);
getch();
return(0);
}
Espero que les sirvan de ayuda, estos son programas creados por mi. Basicos.
Si conoces alguno mas.. Escribelo, esperamos que sea de tu ayuda, estos programas pueden ayudar a los que ingresan a estudios superiores.. Si notas algun error en la escritura de alguno, asmelo saber, si no, que te ayuden.
FTE: Frack-Luck










Autor


En línea





.









