Home > Enterprise >  What language is this? I would like to know the resulting URL
What language is this? I would like to know the resulting URL

Time:03-31

I was wondering what compiler I should use for this code, I already tried C, Python and Swift. Swift told me it was a C-programming language.

s = ' '
a = '1112031584'
for (i = 1; i < length(a) ; i  ) {
  if (a[i] % 2 == a[i-1] % 2)  {
    s  = max(a[i], a[i-1])
  }
}
goto_url('www.multisoft.se/'   s)

I found it in an ad for a company called Multisoft. I really want to know where the resulting URL takes me.

Thanks in advance! :)

CodePudding user response:

This is valid JavaScript, were you to provide length, max and goto_url. With small additional changes, it's also valid C, Perl, Java, ...

But it's probably not meant to be any one specific language. Rather, it's surely pseudocode any programmer should find understandable. It has a "C-like" syntax since a large number of languages do.

CodePudding user response:

It is not a specific language, it is a pseudocode. Below is given the C version to execute.

#include <stdio.h>
#include <string.h>


int max(int a, int b) {
        return a > b ? a : b;
}

int main(void)
{

char s[20];
char a[] = "1112031584";
int i=0;
int j=0;

for (i = 1; i < strlen(a) ; i  ) {
  if (a[i] % 2 == a[i-1] % 2)  {
        s[j]=max(a[i],a[i-1]);
        j  ;
        }
}
printf(" The link is : www.multisoft.se/%s ",s );
//goto_url('www.multisoft.se/'   s);
}
  •  Tags:  
  • c url
  • Related