Jump to content

What language is this?

- - - - -

  • Please log in to reply
6 replies to this topic

#1
saami

saami

    Newbie

  • Members
  • Pip
  • 2 posts
Hello
Can someone explain this plz and where to learn about it. Thx

students: numbered 0 to m-1
courses: numbered 0 to n-1
M[i,j]=mark obtained by student i on course j

/* obtain the average mark for student i */
a:=0; j:=0; n=number of columns of M
While j<n
a:=a+M[i, j];
j:=j+1;
EndWhile
a:=a/n;

#2
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts
Hmm... This seems suspiciously like homework. Is this a school assignment?
-CDG10620
Software Developer

#3
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 763 posts
I don't know the actual language of the code. But it's very similar with Pascal. In fact only EndWhile and the missing of keyword do and begin after while line that made it definitely not pascal. Other than those, all of them were Pascal.

About what it does:

Quote

While j<n
a:=a+M[i, j];
j:=j+1;
EndWhile

These were totalling marks from all courses the student i attended.

Quote

a:=a/n;

And this calculates the average mark.

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
I saw this in a powerpoint lecture (not saw, found it online when someone asked the same question ages ago), it is most likely homework.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
I suspect it's just pseudocode that's based on Pascal syntax.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
saami

saami

    Newbie

  • Members
  • Pip
  • 2 posts
No its not a homework, it was given in a lecture and i didn't understand it.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
It still appears to be pseudocode.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users