Portada


DIAGRAMA DE FLUJO PARA CALCULAR EL PROMEDIO DE TRES NOTAS


¡Saludos cibernauta! hoy en conocesobreinformatica.com te presentamos el siguiente artículo titulado: “Diagrama de flujo para calcular el promedio de tres notas".

A continuación te enseñamos como desarrollar este algoritmo en distintos lenguajes de programación.

Sin más que agregar, empecemos...


ANÁLISIS:
DIAGRAMA DE FLUJO PARA CALCULAR EL PROMEDIO DE TRES NOTAS


DATOS:

- Entrada: Cuatro variables para guardar las notas. Nota1, Nota2, Nota3 y finalmente Promedio.
- Proceso: Operación matemática: Promedio = (Nota1+Nota2+Nota3)/3.
- Salida: Mostrar el valor registrado en la variable: Promedio.


VISUALIZAR DIAGRAMA DE FLUJO

Desarrollado en DFD Software


PSEUDOCÓDIGO

INICIO
 VARIABLE
 NOTA1, NOTA2, NOTA3, PROM
 ESCRIBIR -> "Ingrese 3 Notas:"
 LEER <- NOTA1, NOTA2, NOTA3
 PROM <- (NOTA1+NOTA2+NOTA3)/3
 ESCRIBIR -> "El Promedio es : " PROM
FIN

PSEINT

Algoritmo Secuencial01
  Definir Nota1, Nota2, Nota3 como Entero;
  Definir Prom como Real;
  Escribir "Ingrese Nota 01 : ";
  Leer Nota1;
  Escribir "Ingrese Nota 02 : ";
  Leer Nota2;
  Escribir "Ingrese Nota 03 : ";
  Leer Nota3;
  Prom <- (Nota1+Nota2+Nota3)/3;
  Escribir "EL PROMEDIO ES : ", Prom;
FinAlgoritmo

PYTHON

if __name__ == '__main__':
     print("Ingrese Nota 01 : ")
     nota1 = int(input())
     print("Ingrese Nota 02 : ")
     nota2 = int(input())
     print("Ingrese Nota 03 : ")
     nota3 = int(input())
     prom = (nota1+nota2+nota3)/3
     print("EL PROMEDIO ES : ",prom)

PHP

<?php
     $xnota1 = $_POST['nota1'];
     $xnota2 = $_POST['nota2'];
     $xnota3 = $_POST['nota3'];
     $xprom = ($xnota1 + $xnota2 + $xnota3)/3;
     print 'Nota 1 Ingresada: ' . $xnota1;
     print '<br />Nota 2 Ingresada: ' . $xnota2;
     print '<br />Nota 3 Ingresada: ' . $xnota3;
     print '<br />El Promedio es: ' . $xprom;
?> 
<html>
    <head>
         <title>Secuencial - Ejercicio 01</title>
   </head>
<body>
   <form name="form1" method="post" action="promedio.php">
         NOTA 01 : <input name="nota1" type="text" id="nota1"> <br />
         NOTA 02 : <input name="nota2" type="text" id="nota2"> <br />
         NOTA 03 : <input name="nota3" type="text" id="nota3"> <br />
         <input type="submit" name="submit" value="PROMEDIAR"> 
   </form>
</body>
</html>

C

#include<stdio.h>
int main() {
    float nota1, nota2, nota3, prom ; 

    printf("Ingrese Nota 01 : ");
    scanf("%f", &nota1);
    printf("Ingrese Nota 02 : ");
    scanf("%f", &nota2);
    printf("Ingrese Nota 03 : ");
    scanf("%f", &nota3);
    prom = (nota1+nota2+nota3)/3;
    printf("EL PROMEDIO ES : %.2f\n", prom);
    return 0;
}

C++

#include<iostream>
using namespace std;
int main() {
    float nota1, nota2 nota3, prom(0.0f);
    const int nDec(4);
                    
    cout << "Ingrese Nota 01 : ";
    cin >> nota1;
    cout << "Ingrese Nota 02 : ";
    cin >> nota2;
    cout << "Ingrese Nota 03 : ";
    cin >> nota3;
    prom = (nota1+nota2+nota3)/3;
                    
    cout.precision(nDec);
    cout << "EL PROMEDIO ES : " << prom;
    return 0;
}

JAVASCRIPT

<html>
    <title>Ejercicio 01:</title>
<head>
    <script language="JavaScript" type="text/javascript">
    function promedio(){
            var nota1=formulario.n1.value;
            var nota2=formulario.n2.value;
            var nota3=formulario.n3.value;
            var prom=(parseFloat(nota1) + parseFloat(nota2) + parseFloat(nota3))/3;
            document.getElementById('resultado').value=prom;
}
    </script>
</head>
<body>
    <form method="get" name="formulario">
        NOTA1 : <input name="n1" type="n1"> <br />
        NOTA2 : <input name="n2" type="n2"> <br />
        NOTA3 : <input name="n3" type="n3"> <br />
        <input type="button" value="Resultado" onClick="promedio()" ><br />
        PROMEDIO : <input name="resultado" id="resultado" type="text" >
    </form>
</body>
</html>

JAVA

public class ejercicio1 {
public static void main(String[] args) {

int nota1, nota2, nota3;
double prom; 
Scanner ingreso=new Scanner(System.in);
System.out.print("Ingrese Nota 1:");
nota1 = Integer.parseInt(ingreso.next());
System.out.print("Ingrese Nota 2:");
nota2 = Integer.parseInt(ingreso.next());
System.out.print("Ingrese Nota 3:");
nota3 = Integer.parseInt(ingreso.next());
prom = (nota1 + nota2 + nota3)/3;
System.out.println("EL PROMEDIO ES : " + prom); }

VISUAL BASIC .NET

Imports System.Console
Module Module1
Dim NOTA1, NOTA2, NOTA3 As Integer
Dim PROM As Decimal
Sub Main()
Write("Ingrese Nota 1: ")
NOTA1 = ReadLine()
Write("Ingrese Nota 2: ")
NOTA2 = ReadLine()
Write("Ingrese Nota 3: ")
NOTA3 = ReadLine()
PROM = (NOTA1 + NOTA2 + NOTA3) / 3
WriteLine("EL POMEDIO ES: " & PROM)
ReadLine()
End Sub
End Module


Hemos llegamos al final de este artículo, como equipo de CSI esperamos realmente toda la información recopilada y analizada te resulte de utilidad en tus estudios o vida laboral.

Te recordamos que hoy por hoy conocesobreinformatica cuenta con las siguientes redes para mantener al tanto de toda la información nueva:


- Suscripciones de correo electrónico, se el primero en enterarte de lo que publicamos:


CONTENIDO RELACIONADO

REGRESAR A LA CATEGORÍA:

Programación

Programación

variedad de lenguajes

Deja un comentario