Computer Science Blog

June 18, 2007

Program Menghitung Jumlah Digit-Digit Bilangan

Filed under: Pascal Programming

Program Menghitung_jumlah_digit_digit_bilangan;

uses wincrt;
var
   x,sum,i,z : integer;
   bil : string;
begin
     writeln(’====================================================’);
     writeln(’Program menentukan jumlah digit2 dari bilangan bulat’);
     writeln(’====================================================’);
     writeln;
     write(’Masukkan sebuah Bilangan : ‘); readln(Bil);

     while length(bil)1 do
     begin
         sum := 0;
         for i:=1 to length(bil) do
         begin
              val(bil[i],x,z);
              sum := sum + x;
         end;
         str(sum,bil);
     end;
     writeln;
     writeln(’Hasil jumlah : ‘,bil);

     readkey;
     donewincrt;
end.

Comments »

The URI to TrackBack this entry is: http://gudeg.blogsome.com/2007/06/18/program-menghitung_jumlah_digit_digit_bilangan/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com