Implementation of Luhn Check Algorithm
Code will look much better once OP can use own functions.


  how can I improve my solution?


Meaningful names

Why is the credit card number called j.  How about cc_num?

Many others names need like-wise improvements.

Use bool

For flags, consider bool.

#include &lt;stdbool.h&gt;

bool flag;


Auto format

Use a development environment that supports auto formatting.  Do not format manually - just not efficient.

#include&lt;stdlib.h&gt;
#include&lt;cs50.h&gt;

int main() {
  long long x, j = 0;
  int len, i, len_flag, flag = 0, flag_val = 0, sp_len = 0, check_flag = 0; //basic integers related  to loop etc
  int res, sum, fin_sum = 0, h = 0, d2_sum = 0, d1_sum = 0, ff_num = 0; // variables  related to extracting numbers 
  int sum_len = 0, in_sum = 0, in_fsum = 0, len_sum = 0, m = 0; // extraing numbers from more than single  sum result 
  int sum_f = 0, sum_final = 0;

  do {
    x = get_long("enter a valid card number \n");
    j = x;
    len_flag = 0;
    len = 0;
    while (len_flag != 1) {
      x = x / 10;
      if (x == 0) {
        len_flag = 1;   //finding the lenght of the number 
      }
      len++;
    }
    if (len == 15 || len == 16 || len == 13) {
      flag = 1;
      sp_len = 1;
    } else {
      flag = 1;
    }

  } while (flag != 1);
  ...


Define variables where needed

Rather than a sea of objects up front, defined them where needed.

Example: Refactor x.  Other variables can like-wise get defined closer to their usage.

  // long long x, j = 0;
  long long j = 0;
  ...

  do {
    // x = get_long("enter a valid card number \n");
    long long x = get_long("enter a valid card number \n");
    j = x;
    ...

    if (sum_len &gt; 1) {
      // x = 0;
      int x = 0;


Spelling

//finding the lenght of the number
  finding the length of the number


Clean-up

For review purposes, no need for dead debug code.
Eliminate //printf("multi_res : %d \n",sum), etc.

Eliminate unused variables like m.

Comment code

Each chunk of code deserves to be a function, yet I understand that is prohibited for now.

I'd comment the chunks of code to help aide understanding.

  // Read input CC number
  // Set j as the CC#, len_flag as the CC# length, flag to 1, ...
  do {
    long long x = get_long("enter a valid card number \n");


Simplify

flag only used as 1.

  do {
    ...
      flag = 1;
  } while (flag != 1);


Replaceable with 

  {
    ...
  }


Same for later do {  ... } while (check_flag != 1);.

Documentation

Within code I'd add an algorithm link:

// https://en.wikipedia.org/wiki/Luhn_algorithm


Why space before '\n' ?

// "enter a valid card number \n"
"enter a valid card number\n"


Chunks of code seem verbose

len_flag = 0;
len = 0;
while (len_flag != 1) {
  x = x / 10;
  if (x == 0) {
    len_flag = 1;   //finding the lenght of the number 
  }
  len++;
}


versus

// decimal digit length of x
len = 0;
do {
  len++;
} while (x /= 10);