💻 Hacer un programa que ingrese un monto o cantidad, si el monto fuese mayor a $500 calcular y mostrar el 18%.
Para este ejercicio se usa una condicional simple, al preguntar si un monto ingresado es mayor que $500.
ANÁLISIS DEL CÓDIGO
VARIABLES A USAR :
num = Guarda un monto ingresado por teclado.
INGRESO : Ingresar un monto por teclado en la variable (num).
PROCESO : Si el monto es mayor a $500 sacar el 18% que es igual a (num * 18%).
SALIDA : Mostrar en 18% del monto obtenido.
Algoritmo programacion_work
Definir num como Entero;
Escribir "MOSTRAR EL 18% SI EL MONTO INGRESADO ES MAYOR A $500.";
Escribir " ";
Escribir Sin Saltar "INGRESE MONTO : $";
Leer num;
Si num > 500 Entonces
Escribir "EL 18% ES : $", num * 0.18;
FinSi
FinAlgoritmo
print("INGRESAR UN MONTO DE DINERO Y MOSTRAR EL 18%.")
num = int(input("INGRESE MONTO : "))
if num > 500:
print("EL 18% ES : ", num * 0.18)
#include<stdio.h>
int main() {
float num;
printf("MOSTRAR EL 18 PORCIENTO.\n\n");
printf("Ingrese Numero : ");
scanf("%f",&num);
if (num >= 500) {
printf("\nRESULTADO : $. %.0f", (num * 0.18));
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
int num;
cout << "MOSTRAR EL 18 PORCIENTO.\n\n";
cout << "Ingrese Numero : ";
cin << num;
cout << endl;
if (num >= 500) {
cout << "RESULTADO : $. " << (num * 0.18) << endl;
}
return 0;
}
using System;
using System.Collections.Generic;
using System.Text;
namespace programacion_work
{
class calcular_18_porciento
{
static void Main(string[] args)
{
int num;
Console.WriteLine("MOSTRAR EL 18%.\n");
Console.Write("Ingrese Numero : ");
num = int.Parse(Console.ReadLine());
if (num >= 500)
{
Console.WriteLine("\nRESULTADO : " + (num * 0.18));
}
Console.ReadLine();
}
}
}
package programacion_work;
import java.util.Scanner;
public class calcular_18_porciento {
public static void main(String[] args) {
Scanner ingreso=new Scanner(System.in);
int num;
System.out.print("MOSTRAR EL 18% DE UN MONTO INGRESADO.\n\n");
System.out.print("Ingrese Número : ");
num = Integer.parseInt(ingreso.next());
if(num > 500){
System.out.println("EL 18% ES : " + (num * 0.18));
}
}
}
private void jBtn_CalcularActionPerformed(java.awt.event.ActionEvent evt) {
int num;
num = Integer.parseInt(jTxt_num.getText());
if( num > 500 ){
jLbl_Msg.setText("EL DESCUENTO DE 18% ES : $" + String.valueOf(num * 0.18));
}else{
jLbl_Msg.setText("NO HAY DESCUENTO");
}
}
Imports System.Console
Module calcular_18_porciento
Dim num As Integer
Sub Main()
WriteLine("17. SI EL MONTO INGRESADO ES MAYOR A 500 CALCULAR EL 18%.")
WriteLine("")
Write("Ingrese Monto : ")
num = ReadLine()
WriteLine("")
If (num >= 500) Then
WriteLine("RESULTADO : " & (num * 0.18))
End If
ReadLine()
End Sub
End Module
Private Sub Btn_Calcular_Click(sender As Object, e As EventArgs) Handles Btn_Calcular.Click
Dim num As Integer
num = Txt_Monto.Text
If (num >= 500) Then
Lbl_msg.Text = "El 18% es : " & Math.Round((num * 0.18), 2)
Else
Lbl_msg.Text = "No se Cálcula el 18%"
End If
End Sub
Sub igv()
Dim Num As Integer
Num = Range("C12").Value
If (Num > 500) Then
Range("G12").Value = Num * 0.18
Else
Range("G12").Value = "NO TIENE IGV"
End If
End Sub
Sub IGV_2()
Dim Num As Integer
Num = InputBox("INGRESE NÚMERO ")
If (Num > 500) Then
MsgBox "IGV 18% ES : " & Num * 0.18
Else
MsgBox "NO TIENE IGV"
End If
End Sub
Private Sub btn_calcular_Click()
Dim Num As Integer
Num = txt_num.Text
If (Num > 500) Then
Label5.Caption = "EL IGV DE 18% ES :"
txt_result.Text = Num * 0.18
Else
txt_result.Text = "NO TIENE IGV"
End If
End Sub