Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  numbers
Language: C/C++
Code:
#include <stdio.h>
#include <stdlib.h>
 
int main ( void )
{
    char reps_char[BUFSIZ];
    char high_char[BUFSIZ];
    int reps;
    int high;
    int counter=0;
    
    FILE * Output;
    Output = fopen("out.txt", "w");

    printf("Enter number of repititions: ");                                                                                                                                                                
    scanf("%s", reps_char);
    reps=atoi(reps_char);

    printf("Enter highest number value: ");                                                                                                                                                                
    scanf("%s", high_char);
    high=atoi(high_char);

    for ( int x = 0; x < high; x++ ) 
    {
       counter=counter+1;

       for ( int y = 0; y < reps; y++ )
       {
         fprintf(Output, "%d\n", x);
       }
    }   
       
    fclose(Output);

}     
          
          
          
          
          
          
          
          
Comments: