fork download
  1. #include “stdafx.h” // only for Visual Studios
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <math.h>
  5.  
  6. int main(void)
  7. {
  8. unsigned int I; // outer counter
  9. int negi;//negative value
  10. unsigned int j; // inner counter
  11. unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
  12. current factorial value
  13. //part a
  14. puts(“X\t\ A.)Factorial of 1 to 16);
  15.  
  16. for (i = 2; I <= 16; i+=2)
  17. {
  18. factorial = 1;
  19. // calculate factorial of current number
  20. for (j = 1; j <= I; ++j)
  21. {
  22.  
  23. factorial = j;
  24. } // end Factorial loop
  25.  
  26. printf(%u\t\t %u\t\t \n\n” , i, factorial);
  27.  
  28. } // end outer for
  29.  
  30. puts (“X\t\B.) Square of even #’s -16 to 16”) ;
  31. for (i = 2; i <= 16; i += 2){
  32. square = 1;//pos square value
  33. for (j =1 ; j <= i; ++j)
  34. {
  35. square = pow(j, 2.0);
  36. }
  37. negsquare = 1;//neg square value
  38. for (j = 1 ; j <= i; ++j)
  39. {
  40. negi = i(-1);
  41. negsquare = square;
  42. }
  43. printf(%u\t\t\ %u\t\t\n\n”, i, square);
  44. printf(%d\t\t %d\t\t\n\n”, negi, negsquare);
  45. }//end of square loop
  46.  
  47. //part c
  48. puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
  49. for (i = 1; i <= 17; i += 2){
  50. cube = 1;//pos square value
  51. for (j = 1; j <= i; ++j)
  52. {
  53. cube = pow(j, 3.0);
  54. }
  55. negcube = 1;//neg cube value
  56. for (j = 1; j <= i; ++j)
  57. {
  58. fourth = pow(j, 4.0);
  59. }
  60. negfourth = 1;//neg cube value
  61. for (jn= 1; j <= i; ++j)
  62. {
  63. negi = i*(-1)
  64. negfourth = fourth;
  65. }
  66. printf(%u\t\t %u\t\t \n\n”, i, fourth);
  67. printf(%d\t\t %d\t\t \n\n”, negi, negfourth);
  68. } // end main
  69.  
  70.  
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:10: error: #include expects "FILENAME" or <FILENAME>
 #include “stdafx.h” // only for Visual Studios
          ^
prog.c: In function ‘main’:
prog.c:12:1: error: unknown type name ‘current’
 current factorial value
 ^~~~~~~
prog.c:12:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘value’
 current factorial value
                   ^~~~~
prog.c:14:7: error: stray ‘\342’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
       ^
prog.c:14:8: error: stray ‘\200’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
        ^
prog.c:14:9: error: stray ‘\234’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
         ^
prog.c:14:11: error: stray ‘\’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
           ^
prog.c:14:13: error: stray ‘\’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
             ^
prog.c:14:38: error: stray ‘\342’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
                                      ^
prog.c:14:39: error: stray ‘\200’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
                                       ^
prog.c:14:40: error: stray ‘\235’ in program
  puts(“X\t\ A.)Factorial of 1 to 16”);
                                        ^
prog.c:16:7: error: ‘i’ undeclared (first use in this function)
  for (i = 2; I <= 16; i+=2)
       ^
prog.c:16:7: note: each undeclared identifier is reported only once for each function it appears in
prog.c:23:14: error: stray ‘\357’ in program
    factorial = j;
              ^
prog.c:23:15: error: stray ‘\200’ in program
    factorial = j;
               ^
prog.c:23:16: error: stray ‘\252’ in program
    factorial = j;
                ^
prog.c:26:10: error: stray ‘\342’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
          ^
prog.c:26:11: error: stray ‘\200’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
           ^
prog.c:26:12: error: stray ‘\234’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
            ^
prog.c:26:13: error: expected expression before ‘%’ token
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
             ^
prog.c:26:15: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
               ^
prog.c:26:17: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                 ^
prog.c:26:22: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                      ^
prog.c:26:24: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                        ^
prog.c:26:27: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                           ^
prog.c:26:29: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                             ^
prog.c:26:31: error: stray ‘\342’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                               ^
prog.c:26:32: error: stray ‘\200’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                                ^
prog.c:26:33: error: stray ‘\235’ in program
   printf(“%u\t\t %u\t\t \n\n” , i, factorial);
                                 ^
prog.c:30:7: error: stray ‘\342’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
       ^
prog.c:30:8: error: stray ‘\200’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
        ^
prog.c:30:9: error: stray ‘\234’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
         ^
prog.c:30:11: error: stray ‘\’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
           ^
prog.c:30:10: error: ‘X’ undeclared (first use in this function)
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
          ^
prog.c:30:12: error: expected ‘)’ before ‘t’
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
            ^
prog.c:30:13: error: stray ‘\’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
             ^
prog.c:30:18: error: expected ‘;’ before ‘Square’
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                  ^~~~~~
prog.c:30:33: error: stray ‘#’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                 ^
prog.c:30:34: error: stray ‘\342’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                  ^
prog.c:30:35: error: stray ‘\200’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                   ^
prog.c:30:36: error: stray ‘\231’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                    ^
prog.c:30:48: error: stray ‘\342’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                                ^
prog.c:30:49: error: stray ‘\200’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                                 ^
prog.c:30:50: error: stray ‘\235’ in program
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                                  ^
prog.c:30:51: error: expected statement before ‘)’ token
 puts (“X\t\B.) Square of even #’s -16 to 16”) ;
                                                   ^
prog.c:40:13: error: stray ‘\357’ in program
     negi = i(-1);
             ^
prog.c:40:14: error: stray ‘\200’ in program
     negi = i(-1);
              ^
prog.c:40:15: error: stray ‘\252’ in program
     negi = i(-1);
               ^
prog.c:40:12: warning: implicit declaration of function ‘i’ [-Wimplicit-function-declaration]
     negi = i(-1);
            ^
prog.c:43:10: error: stray ‘\342’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
          ^
prog.c:43:11: error: stray ‘\200’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
           ^
prog.c:43:12: error: stray ‘\234’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
            ^
prog.c:43:13: error: expected expression before ‘%’ token
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
             ^
prog.c:43:15: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
               ^
prog.c:43:17: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                 ^
prog.c:43:19: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                   ^
prog.c:43:23: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                       ^
prog.c:43:25: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                         ^
prog.c:43:27: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                           ^
prog.c:43:29: error: stray ‘\’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                             ^
prog.c:43:31: error: stray ‘\342’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                               ^
prog.c:43:32: error: stray ‘\200’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                                ^
prog.c:43:33: error: stray ‘\235’ in program
   printf(“%u\t\t\ %u\t\t\n\n”, i, square);
                                 ^
prog.c:44:10: error: stray ‘\342’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
          ^
prog.c:44:11: error: stray ‘\200’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
           ^
prog.c:44:12: error: stray ‘\234’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
            ^
prog.c:44:13: error: expected expression before ‘%’ token
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
             ^
prog.c:44:15: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
               ^
prog.c:44:17: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                 ^
prog.c:44:22: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                      ^
prog.c:44:24: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                        ^
prog.c:44:26: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                          ^
prog.c:44:28: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                            ^
prog.c:44:30: error: stray ‘\342’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                              ^
prog.c:44:31: error: stray ‘\200’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                               ^
prog.c:44:32: error: stray ‘\235’ in program
   printf(“%d\t\t %d\t\t\n\n”, negi, negsquare);
                                ^
prog.c:48:7: error: stray ‘\342’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
       ^
prog.c:48:8: error: stray ‘\200’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
        ^
prog.c:48:9: error: stray ‘\234’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
         ^
prog.c:48:11: error: stray ‘\’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
           ^
prog.c:48:12: error: expected ‘)’ before ‘t’
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
            ^
prog.c:48:13: error: stray ‘\’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
             ^
prog.c:48:17: error: expected ‘;’ before ‘Cubes’
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                 ^~~~~
prog.c:48:30: error: stray ‘#’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                              ^
prog.c:48:31: error: stray ‘\342’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                               ^
prog.c:48:32: error: stray ‘\200’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                ^
prog.c:48:33: error: stray ‘\231’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                 ^
prog.c:48:45: error: stray ‘\342’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                             ^
prog.c:48:46: error: stray ‘\200’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                              ^
prog.c:48:47: error: stray ‘\235’ in program
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                               ^
prog.c:48:48: error: expected statement before ‘)’ token
  puts(“X\t\C.)Cubes of odd #’s -17 to 17”);
                                                ^
prog.c:61:8: error: ‘jn’ undeclared (first use in this function)
   for (jn= 1; j <= i; ++j)
        ^~
prog.c:64:4: error: expected ‘;’ before ‘negfourth’
    negfourth = fourth;
    ^~~~~~~~~
prog.c:66:10: error: stray ‘\342’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
          ^
prog.c:66:11: error: stray ‘\200’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
           ^
prog.c:66:12: error: stray ‘\234’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
            ^
prog.c:66:13: error: expected expression before ‘%’ token
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
             ^
prog.c:66:15: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
               ^
prog.c:66:17: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                 ^
prog.c:66:22: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                      ^
prog.c:66:24: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                        ^
prog.c:66:27: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                           ^
prog.c:66:29: error: stray ‘\’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                             ^
prog.c:66:31: error: stray ‘\342’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                               ^
prog.c:66:32: error: stray ‘\200’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                                ^
prog.c:66:33: error: stray ‘\235’ in program
   printf(“%u\t\t %u\t\t \n\n”, i, fourth);
                                 ^
prog.c:67:10: error: stray ‘\342’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
          ^
prog.c:67:11: error: stray ‘\200’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
           ^
prog.c:67:12: error: stray ‘\234’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
            ^
prog.c:67:13: error: expected expression before ‘%’ token
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
             ^
prog.c:67:15: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
               ^
prog.c:67:17: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                 ^
prog.c:67:22: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                      ^
prog.c:67:24: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                        ^
prog.c:67:27: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                           ^
prog.c:67:29: error: stray ‘\’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                             ^
prog.c:67:31: error: stray ‘\342’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                               ^
prog.c:67:32: error: stray ‘\200’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                                ^
prog.c:67:33: error: stray ‘\235’ in program
   printf(“%d\t\t %d\t\t \n\n”, negi, negfourth);
                                 ^
prog.c:68:2: error: expected declaration or statement at end of input
  } // end main
  ^
prog.c:11:68: warning: variable ‘negfourth’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
                                                                    ^~~~~~~~~
prog.c:11:60: warning: variable ‘fourth’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
                                                            ^~~~~~
prog.c:11:51: warning: variable ‘negcube’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
                                                   ^~~~~~~
prog.c:11:45: warning: variable ‘cube’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
                                             ^~~~
prog.c:11:34: warning: variable ‘negsquare’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
                                  ^~~~~~~~~
prog.c:11:15: warning: variable ‘factorial’ set but not used [-Wunused-but-set-variable]
  unsigned int factorial, square, negsquare, cube, negcube, fourth, negfourth; //
               ^~~~~~~~~
prog.c:9:6: warning: variable ‘negi’ set but not used [-Wunused-but-set-variable]
  int negi;//negative value
      ^~~~
stdout
Standard output is empty