#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,k,x,y,a[100][100],b[100][100],c[100][100];
printf("masukkan baris :");
scanf("%d",&x);
printf("masukkan kolom :");
scanf("%d",&y);
for(i=1;i<=x;++i)
{
for(j=1;j<=y;++j)
{
printf("Baris %d kolom %d :",i,j);
scanf("%d",&a[i][j]);
}
}
printf("Matriks A =>");
printf("\n");
for(i=1;i<=x;++i)
{
for(j=1;j<=y;++j)
printf("%d ",a[i][j]);
printf("\n");
}
for(i=1;i<=x;++i)
{
for(j=1;j<=y;++j)
{
printf("Baris %d kolom %d :",i,j);
scanf("%d",&b[i][j]);
}
}
printf("Matriks B =>");
printf("\n");
for(i=1;i<=x;++i)
{
for(j=1;j<=y;++j)
printf("%d ",b[i][j]);
printf("\n");
}
printf("Matriks c hasil pertambahan adalah: =>");
printf("\n");
for(i=1;i<=x;++i)
for(j=1;j<=y;++j)
c[i][j]=a[i][j]+b[i][j];
for(i=1;i<=x;++i)
{
for(j=1;j<=y;++j)
printf("%d ",c[i][j]);
printf("\n");
}
getch();
}
Minggu, 29 Maret 2015
PROGRAM MENCARI NILAI MAX DARI 3 INPUT BILANGAN
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double bil1;
double bil2;
double bil3;
double max;
bil1 = Convert.ToDouble(textBox1.Text);
bil2 = Convert.ToDouble(textBox2.Text);
bil3 = Convert.ToDouble(textBox3.Text);
if (bil1 > bil2)
{
if (bil1 > bil3)
max = bil1;
else
max = bil3;
textBox4.Text = max.ToString();
}
else if (bil1 > bil3)
{
if (bil1 > bil2)
max = bil1;
else
max = bil2;
textBox4.Text = max.ToString();
}
else if (bil2 > bil1)
{
if (bil2 > bil3)
max = bil2;
else
max = bil3;
textBox4.Text = max.ToString();
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double bil1;
double bil2;
double bil3;
double max;
bil1 = Convert.ToDouble(textBox1.Text);
bil2 = Convert.ToDouble(textBox2.Text);
bil3 = Convert.ToDouble(textBox3.Text);
if (bil1 > bil2)
{
if (bil1 > bil3)
max = bil1;
else
max = bil3;
textBox4.Text = max.ToString();
}
else if (bil1 > bil3)
{
if (bil1 > bil2)
max = bil1;
else
max = bil2;
textBox4.Text = max.ToString();
}
else if (bil2 > bil1)
{
if (bil2 > bil3)
max = bil2;
else
max = bil3;
textBox4.Text = max.ToString();
}
}
}
}
PROGRAM MENCARI KONVERSI SUHU DARI CELCIUS KE SUHU LAIN DENGAN C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double celcius;
double fahrenheit;
double reamur;
double kelvin;
if (radioButton1.Checked == true)
{
celcius = Convert.ToDouble(textBox1.Text);
reamur = celcius * 4 / 5;
textBox2.Text = reamur.ToString();
}
else
{
if (radioButton2.Checked == true)
{
celcius = Convert.ToDouble(textBox1.Text);
kelvin = celcius + 273;
textBox2.Text = kelvin.ToString();
}
else
{
celcius = Convert.ToDouble(textBox1.Text);
fahrenheit = (celcius + 32) * 9 / 5;
textBox2.Text = fahrenheit.ToString();
}
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double celcius;
double fahrenheit;
double reamur;
double kelvin;
if (radioButton1.Checked == true)
{
celcius = Convert.ToDouble(textBox1.Text);
reamur = celcius * 4 / 5;
textBox2.Text = reamur.ToString();
}
else
{
if (radioButton2.Checked == true)
{
celcius = Convert.ToDouble(textBox1.Text);
kelvin = celcius + 273;
textBox2.Text = kelvin.ToString();
}
else
{
celcius = Convert.ToDouble(textBox1.Text);
fahrenheit = (celcius + 32) * 9 / 5;
textBox2.Text = fahrenheit.ToString();
}
}
}
}
}
Langganan:
Postingan (Atom)