# include <stdio.h>
# include <conio.h>
# include <iostream.h>
main( )
{
int a, b, c, d,e;
clrscr( );
cout<<"Masukan Nilai A : "; cin>>a;
cout<<"Masukan Nilai B : "; cin>>b;
c = a % b;
d = a * b;
e = a + b;
cout<<"Hasil dari C = A % B adalah "<<c<<ends;
cout<<"Hasil dari D = A * B adalah "<<d<<ends;
cout<<"Hasil dari E = A + B adalah "<<e<<ends;
getch( );
}
2. Hexadesimal-------------------------------------------------------------------------------
# include <iostream.h>
# include <iomanip.h>
main( )
{
float a,b,c;
a = 25.23;
b = 12.54;
clrscr( );
c = a * b;
cout<<setiosflags(ios::fixed);
cout<<setprecision(1)<<c<<endl;
cout<<setprecision(2)<<c<<endl;
cout<<setprecision(3)<<c<<endl;
cout<<setprecision(4)<<c<<endl;
cout<<setprecision(5)<<c<<endl;
getch( );
}
3. Program Nilai------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main( )
{
float a1=87.5, a2=77.50, a3=80.00;
clrscr();
printf("Nilai Tugas 1: %2.2f \n",a1);
printf("Nilai Tugas 2: %2.2f\n",a2);
printf("Nilai Tugas 3: %3.2f",a3);
getch( );
}
Tidak ada komentar:
Posting Komentar