Skip to content

Instantly share code, notes, and snippets.

@neko314
Created April 9, 2018 10:30
Show Gist options
  • Save neko314/727f082bec061aed3ae7aecc4dbc93c6 to your computer and use it in GitHub Desktop.
Save neko314/727f082bec061aed3ae7aecc4dbc93c6 to your computer and use it in GitHub Desktop.
Rakefile
# coding: utf-8
CC = "gcc"
desc "the sum from 1 to 100"
task :default => "sum"
file "sum" => "sum.o" do
sh "#{CC} -o sum sum.o"
end
file "sum.o" => "sum.c" do
sh "#{CC} -c sum.c"
end
// ©佐伯英子 http://saeki-ce.xsrv.jp/Cgengo.html
/********************/
/* 総和を計算する */
/********************/
#include <stdio.h>
int main( )
{
int sum=0,i=1;
while( i<=100 )
{
sum+=i;
i++;
}
printf("\n1 から 100 までの総和は %d です\n",sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment