2

// mainheader.h

int square(int b);

// maiNfunction.c

#include"mainheader.h"
#include<stdio.h>


int square(int b)
{
  int y;
  y= b*b;
  return (y);
}

//=====maiN.c file

#include<stdio.h>
//#include<stdlib.h>
 #include<math.h>
 #include"mainheader.h"
 #include"maiNfunction.h"

 main(void)
 {
    //int SizeOfData,j;

      int i,z;
      for(i=0;i<5;i++)
        {
            z=square(i);
            printf("%d\n",i);
        }

}

how do i run this program in ubuntu?

1 Answers1

1

This looks like c sourcecode, which needs to be compiled first.

gcc -o programName maiNfunction.c maiN.c

This creates an executable file, which already should have the permission to be executed. You can run it by typing:

./programName

Maybe you should consider reading more of the compiler documentation.

In case, you didn't do that yet, you of course need to install a compiler (e.g. gcc).

engineer
  • 133
  • 1
  • 1
  • 8