ciclo for y while en c.docx - INSTITUTO TECNOLOGICO DE LOS...

  • No School
  • AA 1
  • 4

This preview shows page 1 - 4 out of 4 pages.

INSTITUTO TECNOLOGICO DE LOS MOCHIS Ejemplos Ciclos For y While en Programa C Alumna: Briseño Visaiz Andrea Madai Grupo: 541 Ejemplo For 1: Programa que imprime el valor actual de una variable en cada ciclo. #include<stdio.h> #include<stdlib.h> void main() { int i; for(i=0; i<=20; i++) printf(“Soy la variable i, mi valor en esta iteracion es: %d\n”,i); system(“pause”); } Ejemplo For 2: Programa que suma los 10 primeros número enteros. #include<stdio.h> #include<stdlib.h> void main() { int num;
Image of page 1

Subscribe to view the full document.

int suma=0; for(num=0; num<=10; num++) { suma = suma + num; } printf(“Suma = %d\n”,suma); system(“pause”); } Ejemplo For 3: Programa que muestra de forma descendente los números del 0 al 10. #include<stdio.h> #include<stdlib.h> void main() { int numero; for(numero=10; numero >= 0; numero–) printf(“%d\n”,numero); system(“pause”);
Image of page 2
Image of page 3

Subscribe to view the full document.

Image of page 4
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes