Cilcos-curso De Progra

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Cilcos-curso De Progra as PDF for free.

More details

  • Words: 155
  • Pages: 2
Cilcos Sintaxis: While (condicion) { Sentencias; Incremento; } Ejemplo: Num=10 While (num<=100) { Cout< #include //Declaracion de variables int num, x, cont, suma; //Inicia ejecucion de programa void main() {

cout<<"Ingrese un numero: "<<"\n"; cin>>num; for (x=1; x<=num; x++) { If (num%x==0) { suma=suma+x; } } cout<<”La suma de los divisores exactos es: “<<suma<<"\n"; } Suma de divisores con while //Programa de suma de divisores exacots utilizando ciclo while //Incluyendo librerias #include <stdlib.h> #include //Declaracion de variables int x, num, suma; //Inicia ejecucion del programa void main() { cout<<"Ingrese un numero: \n"; cin>>num; x=1; while(x<=num) { if(num%x==0) { suma=suma+x; } x++; } cout<<"La suma de los divisores exactos del numero ingresado es: "<<suma<<"\n"; }

Related Documents

Progra
May 2020 9
Progra 01
October 2019 5
Progra No Lineal
June 2020 5