2010年9月24日 星期五

99乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
    static void Main(string[] args)
{
int[,] array = new int[10, 10];

for (int a = 1; a <= 9; a++)
{
for (int b = 1; b <= 9; b++)
{
array[a, b] = a * b;
}
}
for (int c = 1; c <= 9; c++)
{
    for (int d = 1; d <= 9; d++)
    {
    Console.WriteLine("" + c + "*" + d + "=" + array[c, d]);
    }
}
}
    }
}

2010年9月17日 星期五

+1~100

#include <stdio.h>
#include <conio.h>
int main()
{
int i;
int sum;

sum = 0;
for (i = 1; i <= 100; i++)
sum += i;
printf("1加到100總和是%d\n", sum);
getch();
return(0);
}