3

I want to print this:

    printf("please Choose: 1-For Checking what is the most popular number in the array\n               2-To sort your array from the smallest number to the biggest\n               3-To sort your array that even will be to your left and odd to the right\n               *Any other number will exit the program\n");

there is a way to define number of spaces after '\n' instead of typing lot of spaces?

Ron
  • 33
  • 7

1 Answers1

3

Try:

printf("%Ns\n", "");

where N is the number of spaces you want to display.

This way you are displaying an empty string preceded by N spaces.

printf("please Choose: 1-For Checking what is the most popular number in the array\n%8s2-To sort your array from the smallest number to the biggest\n%8s3-To sort your array that even will be to your left and odd to the right\n%8s*Any other number will exit the program\n", "", "", "");
JFMR
  • 23,265
  • 4
  • 52
  • 76