lunes, 23 de julio de 2007

Practica 4: Ejercicios de programas basicos en lenguaje C

Profesor: Lic. Salomon Aquino
Materia: Logica Computacional

Escriba los siguientes ejemplo de programas en C en el compilador Devcpp:

Ejemplo 1
Primer programa en lenguaje C:

/* Mi primer programa completo en Lenguage C.
Imprime un texto en pantalla. */

#include < stdio.h >
#include < stdlib.h >

int main()

{

printf(“Hola mundo!!\n”);
system("pause");
return 0;
}

Modifique el programa para que en vez de Hola Mundo aparezca tu nombre, por ejemplo: Hola Salomon Aquino.


Ejemplo 2
Segundo programa en lenguaje C:

#include < stdio.h >
#include < stdlib.h >
#include < conio.h >
main()
{
int a, b, c, suma;
a=6;
b=4;
c=17;
suma = a + b + c;
printf ("\n La suma es : %d ", suma);
printf("\n");
system("pause");
return 0;
}

ahora vamos a modificar el programa para que solicite los valores de a, b y c y estos se introduzcan por el teclado, el programa quedaria de la siguiente manera:

#include < stdio.h >
#include < stdlib.h >
#include < conio.h >
main()
{
int a, b, c, suma;

printf("Introduzca el valor de a : ");
scanf("%d", &a);
printf("\n");

printf("Introduzca el valor de b : ");
scanf("%d", &b);
printf("\n");

printf("Introduzca el valor de c : ");
scanf("%d", &c);
printf("\n");

suma = a + b + c;
printf ("\n La suma es : %d ", suma);
printf("\n");
system("pause");
return 0;
}

Ejemplo 3

/* Este ejemplo muestra el uso de variables tipo char y tipo int */
#include < stdio.h >
#include < stdlib.h >
#include < conio.h >

main ( )
{
char nombre[30];
int edad;
printf ("Escriba su nombre: ");
scanf ("%s", nombre);
printf ("\n Escriba la edad de %s: ", nombre);
scanf ("%d", &edad);
printf("\n");
printf ("Su nombre es: %s ", nombre);
printf("\n");
printf ("Su edad es: %d ", edad);
printf ("\n");
system("pause");
return 0;
}

Ejemplo 4
Este programa muestra es uso de variables tipo char.


#include < stdio.h >
#include < stdlib.h >

main ( )
{
char nombre[30] ;
printf ("Esta es una secuencia de sentencias\n");
printf("Ahora escriba su nombre (solo su primer nombre): ");
scanf("%s",nombre);
printf ("\nMucho gusto %s.",nombre);
printf ("\nEspero que te estes divirtiendo y aprendiendo el Lenguaje C \n");
printf("Con mucha dedicacion y esfuerzo saldras bien en tus practicas\n");
system("pause");
return 0;
}

Ejemplo 5
Este ejemplo muestra el uso de variables tipo float, pide 3 salarios y los suma.

#include < stdio.h >
#include < stdlib.h >
#include < conio.h >
main()
{
float salario1, salario2, salario3, suma;

printf("Introduzca el valor de salario1 : ");
scanf("%f", &salario1);
printf("\n");

printf("Introduzca el valor de salario2 : ");
scanf("%f", &salario2);
printf("\n");

printf("Introduzca el valor de salario3 : ");
scanf("%f", &salario3);
printf("\n");

suma = salario1 + salario2 + salario3;
printf ("\n La suma es : %.2f ", suma);
printf("\n");
system("pause");
return 0;
}


Ejercicios:
Escribe un programa en lenguaje C para los siguientes ejercicios:

1. Escribe un programa que calcule el área de un círculo de cualquier radio.
2. Escribe un programa que lea una cantidad depositada en un banco y que calcule la cantidad final después de aplicarle un 20% de interés.
3. Un maestro desea saber que porcentaje de hombres y que porcentaje de mujeres hay en un grupo de estudiantes.
4. Un alumno desea saber cual será su calificación final en la materia de Lógica Computacional. Dicha calificación se compone de tres exámenes parciales cuya ponderación es de 30%, 30% y 40%
5. Una farmacia aplica al precio de los remedios el 10% de descuento. Hacer un programa que ingresado el costo de los medicamentos calcule el descuento y el precio final

19 comentarios:

Anónimo dijo...

http://www.conclase.net/c/librerias/funciones.php

http://es.wikipedia.org/wiki/C%2B%2B

http://www.conclase.net/c/devcpp.php?art=conio

Anónimo dijo...

[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we possess been using [url=http://www.xrumer-seo.com]Xrumer[/url] fitted a large immediately for the time being and grasp how to harness the enormous power of Xrumer and turn it into a Bills machine.

We also provender the cheapest prices on the market. Assorted competitors devise expect 2x or temperate 3x and a a pile of the opportunity 5x what we responsibility you. But we feel in providing gigantic help at a tearful affordable rate. The large point of purchasing Xrumer blasts is because it is a cheaper surrogate to buying Xrumer. So we focusing to keep that mental activity in cognizant and afford you with the cheapest standing possible.

Not just do we be suffering with the greatest prices but our turnaround heyday for your Xrumer posting is super fast. We will take your posting done in the forefront you know it.

We also outfit you with a ample log of affluent posts on contrasting forums. So that you can get the idea also in behalf of yourself the power of Xrumer and how we be struck by harnessed it to help your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can think to see thousands upon thousands of backlinks for your site. Scads of the forums that your Location you will be posted on get high PageRank. Having your join on these sites can really expropriate establish up some top grade back links and really riding-boot your Alexa Rating and Google PageRank rating through the roof.

This is making your put more and more popular. And with this inflate in reputation as well as PageRank you can expect to witness your place definitely filthy high in those Search Mechanism Results.
Conveyance

The amount of conveyance that can be obtained before harnessing the power of Xrumer is enormous. You are publishing your site to tens of thousands of forums. With our higher packages you may equivalent be publishing your position to HUNDREDS of THOUSANDS of forums. Create 1 mail on a all the rage forum last will and testament usually cotton on to a leave 1000 or so views, with announce ' 100 of those people visiting your site. Modern devise tens of thousands of posts on celebrated forums all getting 1000 views each. Your see trade ordain function through the roof.

These are all targeted visitors that are interested or exotic in the matter of your site. Assume how assorted sales or leads you can achieve with this great loads of targeted visitors. You are in fact stumbling upon a goldmine ready to be picked and profited from.

Retain, Traffic is Money.
[/b]

GET YOUR INFERIOR DEFAME TODAY:


http://www.xrumer-seo.com

Anónimo dijo...

[B]NZBsRus.com[/B]
Lose Idle Downloads Using NZB Files You Can Easily Search Movies, PC Games, MP3 Albums, Software & Download Them @ Blazing Speeds

[URL=http://www.nzbsrus.com][B]NZB[/B][/URL]

Anónimo dijo...

Analyse Our Minor Prices at www.Pharmashack.com, The Unrivalled [b][url=http://www.pharmashack.com]Online Apothecary's [/url][/b] To [url=http://www.pharmashack.com]Buy Viagra[/url] Online ! You Can also Look after Greater Deals When You [url=http://www.pharmashack.com/en/item/cialis.html]Buy Cialis[/url] and When You You [url=http://www.pharmashack.com/en/item/levitra.html]Buy Levitra[/url] Online. We Also Catch on a Vast Generic [url=http://www.pharmashack.com/en/item/phentermine.html]Phentermine[/url] On account of Your Victuals ! We Hawk Maker designation [url=http://www.pharmashack.com/en/item/viagra.html]Viagra[/url] and Also [url=http://www.pharmashack.com/en/item/generic_viagra.html]Generic Viagra[/url] !

Anónimo dijo...

Infatuation casinos? subscribe to this latest [url=http://www.realcazinoz.com]casino[/url] advisor and personate evasively online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also stay our lately [url=http://freecasinogames2010.webs.com]casino[/url] mastery at http://freecasinogames2010.webs.com and overwhelm realized folding altering !
another uncommon [url=http://www.ttittancasino.com]casino spiele[/url] within an eyelash of is www.ttittancasino.com , in submit c be communicated behindhand german gamblers, receive a away with the wrong close in unrestrained online casino bonus.

Anónimo dijo...

after payment all to look into this gratis [url=http://www.casinoapart.com]casino[/url] perk at the greatest [url=http://www.casinoapart.com]online casino[/url] signal with 10's of ritzy [url=http://www.casinoapart.com]online casinos[/url]. house [url=http://www.casinoapart.com/articles/play-roulette.html]roulette[/url], [url=http://www.casinoapart.com/articles/play-slots.html]slots[/url] and [url=http://www.casinoapart.com/articles/play-baccarat.html]baccarat[/url] at this [url=http://www.casinoapart.com/articles/no-deposit-casinos.html]no hunting-lodge casino[/url] , www.casinoapart.com
the finest [url=http://de.casinoapart.com]casino[/url] to UK, german and all to the world. so in hamlet of the safeguard [url=http://es.casinoapart.com]casino en linea[/url] into the deep-freeze us now.

Anónimo dijo...

Making money on the internet is easy in the hush-hush world of [URL=http://www.www.blackhatmoneymaker.com]blackhat seo[/URL], It's not a big surprise if you have no clue about blackhat marketing. Blackhat marketing uses little-known or little-understood methods to produce an income online.

buy viagra online dijo...

Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.

Anónimo dijo...

dating 24-7 http://loveepicentre.com/articles.php casual dating toronto casual dating london

Anónimo dijo...

http://site.ru - [url=http://site.ru]site[/url] site
site

MANUALES dijo...

quisiera preguntar si estos ejemplos corren en DEV C++
GRACAIAS

Anónimo dijo...

colossus and the crab ebook http://audiobookscollection.co.uk/Emerging-Directions-in-Embedded-and-Ubiquitous-Computing-EUC-2006-Workshops-NCUS-SecUbiq-USN-TRUST-ESO-and-MSA-Seoul-Korea-August-1-4-2006-Applications-incl-Internet-Web-and-HCI/p209112/ bebook ebook [url=http://audiobookscollection.co.uk/it/Hybrid-Intelligent-Systems-for-Pattern-Recognition-Using-Soft-Computing-An-Evolutionary-Approach-for-Neural-Networks-and-Fuzzy-Systems/p217145/]financial accounting free ebook solutions manuel[/url] aluratek ebook

Anónimo dijo...

dvd translation software http://buysoftwareonline.co.uk/it/product-35362/3herosoft-DVD-to-PSP-Converter-3-5-MacOSX accademic software adobe [url=http://buysoftwareonline.co.uk/product-36821/FastStone-Capture-7-0]panasonic camcorder software for windows vista[/url] windows hard drive file transfer software
[url=http://buysoftwareonline.co.uk/category-100-101/Operation-Systems]Operation Systems - Software Store[/url] golf club fitting software
[url=http://buysoftwareonline.co.uk/es/product-30601/Adobe-Creative-Suite-5-Master-Collection][img]http://buyoem.co.uk/image/5.gif[/img][/url]

Anónimo dijo...

Ahaa, its nice discussion concerning this post here at this webpage, I have
read all that, so now me also commenting at this place.


Also visit my homepage: online casino bonus

Anónimo dijo...

казино 7 regal [url=http://rodmehardcusembma.narod.ru/archive352.html]казино онлайн next[/url] онлайн казино русская рулетка , [url=http://rodmehardcusembma.narod.ru/archive296.html]казино xo минск отзывы[/url] онлайн казино с приветственным бонусом , [url=http://rodmehardcusembma.narod.ru/archive104.html]казино онлайн бесплатно украины[/url] казино гаминатор , [url=http://rodmehardcusembma.narod.ru/archive288.html]слот автоматы в интернет казино[/url] казино чемпион , [url=http://rodmehardcusembma.narod.ru/archive120.html]заработать на интернет казино[/url]

Anónimo dijo...

казино wiki [url=http://foisuralensrile.narod.ru/topic225.html]слот автомат иллюзионист[/url] казино ежедневный бонус , [url=http://foisuralensrile.narod.ru/topic198.html]казино гранд демо игры[/url] интернет казино с живыми дилерами , [url=http://foisuralensrile.narod.ru/topic189.html]казино онлайн бесплатно европа[/url] казино бесплатно через торрент , [url=http://foisuralensrile.narod.ru/topic90.html]азартные игры автоматы слоты[/url] казино кристалл онлайн играть

Anónimo dijo...

интернет казино скачать клиент [url=http://busdeitranspeeddownrai.narod.ru/onlayn-kazino-igrat-na-rubli-i-kopeyki-v-ruletku.html]Онлайн Казино Играть На Рубли И Копейки В Рулетку[/url] интернет казино автоматы играть бесплатно.

Anónimo dijo...


Viagra[url=http://www.viagra.gd]Viagra[/url]http://www.viagra.gd
Adipex [url=http://www.adipexonlinepills.com]Adipex [/url]http://www.adipexonlinepills.com
Levitra[url=http://www.levitra.gd]Levitra[/url]http://www.levitra.gd

Anónimo dijo...

[url=http://test1517.org]test1517.org[/url]
test1517.org
http://test1517.org