Suppose the problem was: you will receive an input file starting with a
number of cases, and then a number for each case, and you are to output in
a sentence the square of each number.

1) Create a c file called squareNumbers.c

#include <stdio.h>

int main(){
  int numCases;
  int value;
  int square;
  scanf("%d", &numCases);

  for (int caseIndex = 1; caseIndex <= numCases; ++caseIndex)
    {
      scanf("%d", &value);
      square = value * value;
      printf("Case #%d: The square of %d is %d.\n", caseIndex, value,
square);
    }
}

2) Download the input file, given here (call it squareNumbers.in)

6
32
1
147
73
0
-92

3) Compile and run your code:

gcc -o squareNumbers squareNumbers.c

./squareNumbers < squareNumbers.in > squareNumbers.out
4) Upload your output file (which should have this content)
Case #1: The square of 32 is 1024.
Case #2: The square of 1 is 1.
Case #3: The square of 147 is 21609.
Case #4: The square of 73 is 5329.
Case #5: The square of 0 is 0.
Case #6: The square of -92 is 8464.


On Mon, Mar 27, 2017 at 7:14 PM, arumugamgandhi156 <
arumugamgandhi...@gmail.com> wrote:

> How to save and submit the output file in c programming language
>
> Sent from my Superphone
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-code/ktsjcojd1gjcimaay5jt2c06.1490638468596%40email.android.
> com
> <https://groups.google.com/d/msgid/google-code/ktsjcojd1gjcimaay5jt2c06.1490638468596%40email.android.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAECKw-NN-YPOvMZQo2ZhqDUeAsGsFdUj1jnBsNN1xnyexH7TLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to