Entradas

Mostrando entradas de enero, 2021

Clase string en C++

#include <iostream> #include <string.h> using namespace std; int main() { //declaración de variables int nt1,nt2,nt3; double prom; char condi[15]; //entrada de datos cout<<"Ingresar Nota1:"; cin>>nt1; cout<<"Ingresar Nota2:"; cin>>nt2; cout<<"Ingresar Nota3:"; cin>>nt3; //proceso de datos prom=(nt1+nt2+nt3)/3.0; if(prom>=10.5) strcpy(condi,"Aprobado"); else strcpy(condi,"Desaprobado"); //salida de datos cout<<"Su promedio: "<<prom<<endl; cout<<"Su condicion: "<<condi<<endl; system("pause"); return 0; }

bucles FOR en JAVA

package packCasos; import javax.swing.*; public class ejemplos {   //metodos STATICOS   static void rangoNumeros(){       String num1,num2;       int x1,x2,x;       num1=JOptionPane.showInputDialog("Ingrese Primer Valor :");       x1=Integer.parseInt(num1);       num2=JOptionPane.showInputDialog("Ingrese Segundo Valor :");       x2=Integer.parseInt(num2);       for (x=x1;x<=x2;x++){           System.out.println(x);       }   }     static void tablamultiplicar(){         String num;         int n1,n,fin;         num=JOptionPane.showInputDialog("Ingrese Numero de Tabla :");         n1=Integer.parseInt(num);         for (n=1;n<=12;n++){          fin=n*n1;          System.out.println(n + " * " + n1 + " = " + fin);         }            }          static void Frase(){       String fra,num;       int n1,re;       fra=JOptionPane.showInputDialog("Ingrese Frase :");       num=JOptionPane.showInputDialog("Ingrese Cantidad a R

Número CAPICUA en JAVA

public static void main(String[] args) {         //variables         int N;         int X=0,S=0,I=0;             String RPTA=null;         //leer         N=Integer.parseInt(JOptionPane.showInputDialog("Ingrese Numero: "));         int NU=N;        //proceso         while(N>0){             X++;             S=S+N%10;             I=I*10+N%10;             N=N/10;         }         if(NU==I)              RPTA = "Es Capicua";         else              RPTA = "No es Capicua";               //imprimir         System.out.println("Respuesta: " + RPTA); }

Suma de Números en C++.NET 2019

#include "stdafx.h" using namespace System; int main() { int a, b, c; a = Int16::Parse(Console::ReadLine()); b = Int16::Parse(Console::ReadLine()); c=a+b; Console::WriteLine(c); Console::Read(); return 0; }