fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <time.h>
  5.  
  6. #define BUFSIZE 160
  7.  
  8. int main()
  9. {
  10. char buf[BUFSIZE];
  11. double y;
  12. int i, col;
  13.  
  14. srand(time(NULL));
  15. y = 1.0;
  16.  
  17. for (i = 0; i < 1000; i++) {
  18. y = y * (0.9 + 0.2 * ((double)rand() / RAND_MAX));
  19. memset(buf, ' ', BUFSIZE);
  20. buf[40] = '|';
  21. col = y * 40.0;
  22. if (col < BUFSIZE) {
  23. buf[col] = '*';
  24. }
  25. printf("%.*s\n", BUFSIZE, buf);
  26. }
  27. return 0;
  28. }
  29.  
Runtime error #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
                                        |  *                                                                                                                    
                                       *|                                                                                                                       
                                     *  |                                                                                                                       
                                        *                                                                                                                       
                                      * |                                                                                                                       
                                       *|                                                                                                                       
                                        |*                                                                                                                      
                                       *|                                                                                                                       
                                        *                                                                                                                       
                                        | *                                                                                                                     
                                       *|                                                                                                                       
                                        | *                                                                                                                     
                                        |*                                                                                                                      
                                        |  *                                                                                                                    
                                        |  *                                                                                                                    
                                        |*                                                                                                                      
                                        |  *                                                                                                                    
                                        | *                                                                                                                     
                                        |  *                                                                                                                    
                                        |*                                                                                                                      
                                       *|                                                                                                                       
                                      * |                                                                                                                       
                                     *  |                                                                                                                       
                                   *    |                                                                                                                       
                                      * |                                                                                                                       
                                     *  |                                                                                                                       
                                        |*                                                                                                                      
                                        |*                                                                                                                      
                                        |    *                                                                                                                  
                                        |      *                                                                                                                
                                        |        *                                                                                                              
                                        |            *                                                                                                          
                                        |               *                                                                                                       
                                        |                    *                                                                                                  
                                        |                        *                                                                                              
                                        |                              *                                                                                        
                                        |                              *                                                                                        
                                        |                                 *                                                                                     
                                        |                             *                                                                                         
                                        |                        *                                                                                              
                                        |                      *                                                                                                
                                        |                    *                                                                                                  
                                        |               *                                                                                                       
                                        |                  *                                                                                                    
                                        |             *                                                                                                         
                                        |             *                                                                                                         
                                        |         *                                                                                                             
                                        |           *                                                                                                           
                                        |                *                                                                                                      
                                        |                   *                                                                                                   
                                        |                         *                                                                                             
                                        |                     *                                                                                                 
                                        |                *                                                                                                      
                                        |                *                                                                                                      
                                        |              *                                                                                                        
                                        |         *                                                                                                             
                                        |            *                                                                                                          
                                        |          *                                                                                                            
                                        |            *                                                                                                          
                                        |               *                                                                                                       
                                        |                     *                                                                                                 
                                        |                   *                                                                                                   
                                        |                      *                                                                                                
                                        |                          *                                                                                            
                                        |                      *                                                                                                
                                        |                        *                                                                                              
                                        |                           *                                                                                           
                                        |                              *                                                                                        
                                        |                            *                                                                                          
                                        |                                  *                                                                                    
                                        |                                        *                                                                              
                                        |                                           *                                                                           
                                        |                                        *                                                                              
                                        |                                               *                                                                       
                                        |                                               *                                                                       
                                        |                                            *                                                                          
                                        |                                            *                                                                          
                                        |                                              *                                                                        
                                        |                                      *                                                                                
                                        |                                     *                                                                                 
                                        |                                   *                                                                                   
                                        |                            *                                                                                          
                                        |                               *                                                                                       
                                        |                               *                                                                                       
                                        |                              *                                                                                        
                                        |                        *                                                                                              
                                        |                        *                                                                                              
                                        |                     *                                                                                                 
                                        |                    *                                                                                                  
                                        |                *                                                                                                      
                                        |            *                                                                                                          
                                        |          *                                                                                                            
                                        |           *                                                                                                           
                                        |               *                                                                                                       
                                        |          *                                                                                                            
                                        |             *                                                                                                         
                                        |             *                                                                                                         
                                        |                 *                                                                                                     
                                        |                 *                                                                                                     
                                        |                      *                                                                                                
                                        |                         *                                                                                             
                                        |                        *                                                                                              
                                        |                         *                                                                                             
                                        |                   *                                                                                                   
                                        |                 *                                                                                                     
                                        |            *                                                                                                          
                                        |           *                                                                                                           
                                        |               *                                                                                                       
                                        |                *                                                                                                      
                                        |                *                                                                                                      
                                        |              *                                                                                                        
                                        |         *                                                                                                             
                                        |         *                                                                                                             
                                        |              *                                                                                                        
                                        |              *                                                                                                        
                                        |                   *                                                                                                   
                                        |             *                                                                                                         
                                        |         *                                                                                                             
                                        |      *                                                                                                                
                                        |     *                                                                                                                 
                                        |   *                                                                                                                   
                                        |  *                                                                                                                    
                                        |    *                                                                                                                  
                                        |       *                                                                                                               
                                        |     *                                                                                                                 
                                        |        *                                                                                                              
                                        |         *                                                                                                             
                                        |            *                                                                                                          
                                        |             *                                                                                                         
                                        |          *                                                                                                            
                                        |            *                                                                                                          
                                        |          *                                                                                                            
                                        |            *                                                                                                          
                                        |        *                                                                                                              
                                        |        *                                                                                                              
                                        |   *                                                                                                                   
                                        | *                                                                                                                     
                                        |   *                                                                                                                   
                                        |       *                                                                                                               
                                        |          *                                                                                                            
                                        |         *                                                                                                             
                                        |      *                                                                                                                
                                        |         *                                                                                                             
                                        |             *                                                                                                         
                                        |         *                                                                                                             
                                        |        *                                                                                                              
                                        |           *                                                                                                           
                                        |        *                                                                                                              
                                        |        *                                                                                                              
                                        |    *                                                                                                                  
                                        |     *                                                                                                                 
                                        |       *                                                                                                               
                                        |       *                                                                                                               
                                        |     *                                                                                                                 
                                        |      *                                                                                                                
                                        |        *                                                                                                              
                                        |    *                                                                                                                  
                                        |  *                                                                                                                    
                                        |  *                                                                                                                    
                                        |    *                                                                                                                  
                                        |    *                                                                                                                  
                                        | *                                                                                                                     
                                      * |                                                                                                                       
                                   *    |                                                                                                                       
                                   *    |                                                                                                                       
                                   *    |                                                                                                                       
                                *       |                                                                                                                       
                                 *      |                                                                                                                       
                                *       |                                                                                                                       
                                   *    |                                                                                                                       
                                   *    |                                                                                                                       
                                    *   |                                                                                                                       
                                 *      |                                                                                                                       
                                 *      |                                                                                                                       
                                 *      |                                                                                                                       
                                *       |                                                                                                                       
                                  *     |                                                                                                                       
                                *       |                                                                                                                       
                                 *      |                                                                                                                       
                                *       |                                                                                                                       
                               *        |                                                                                                                       
                             *          |                                                                                                                       
                          *             |                                                                                                                       
                            *           |                                                                                                                       
                            *           |                                                                                                                       
                            *           |                                                                                                                       
                             *          |                                                                                                                       
                              *         |                                                                                                                       
                               *        |                                                                                                                       
                              *         |                                                                                                                       
                             *          |                                                                                                                       
                           *            |                                                                                                                       
                           *            |                                                                                                                       
                          *             |                                                                                                                       
                         *              |                                                                                                                       
                           *            |                                                                                                                       
                             *          |                                                                                                                       
                            *           |                                                                                                                       
                             *          |                                                                                                                       
                           *            |                                                                                                                       
                          *             |                                                                                                                       
                        *               |                                                                                                                       
                         *              |                                                                                                                       
                         *              |                                                                                                                       
                         *              |                                                                                                                       
                        *               |                                                                                                                       
                          *             |                                                                                                                       
                         *              |                                                                                                                       
                          *             |                                                                                                                       
                          *             |                                                                                                                       
                          *             |                                                                                                                       
                             *          |                                                                                                                       
                              *         |                                                                                                                       
                              *         |                                                                                                                       
                                 *      |                                                                                                                       
                              *         |                                                                                                                       
                            *           |                                                                                                                       
                             *          |                                                                                                                       
                              *         |                                                                                                                       
                                 *      |                                                                                                                       
                                   *    |                                                                                                                       
                                      * |                                                                                                                       
                                    *   |                                                                                                                       
                                  *     |                                                                                                                       
                                 *      |                                                                                                                       
                                 *      |                                                                                                                       
                               *        |                                                                                                                       
                             *          |                                                                                                                       
                               *        |                                                                                                                       
                                 *      |                                                                                                                       
                               *        |                                                                                                                       
                             *          |                                                                                                                       
                                *       |                                                                                                                       
                             *          |                                                                                                                       
                               *        |                                                                                                                       
                              *         |                                                                                                                       
                              *         |                                                                                                                       
                              *         |                                                                                                                       
                                *       |                                                                                                                       
                                   *    |                                                                                                                       
                                *       |                                                                                                                       
                                *       |                                                                                                                       
                                  *     |                                                                                                                       
                                    *   |                                                                                                                       
                                 *      |                                                                                                                       
                                   *    |                                                                                                                       
                                     *  |                                                                                                                       
                                   *    |                                                                                                                       
                                  *     |                                                                                                                       
                                   *    |                                                                                                                       
                                 *      |                                                                                                                       
                              *         |                                                                                                                       
                               *        |                                                                                                                       
                              *         |                                                                                                                       
                              *         |                                                                                                                       
                                *       |                                                                                                                       
                                  *     |                                                                                                                       
                                    *   |                                                                                                                       
                                       *|                                                                                                                       
                                        |*                                                                                                                      
                                        |*                                                                                                                      
                                       *|                                                                                                                       
                                        |  *                                                                                                                    
                                        | *                                                                                                                     
                                        |*                                                                                                                      
                                        | *                                                                                                                     
                                        |    *                                                                                                                  
                                        |      *                                                                                                                
                                        |     *                                                                                                                 
                                        |      *                                                                                                                
                                        |        *                                                                                                              
                                        |       *                                                                                                               
                                        |            *                                                                                                          
                                        |              *                                                                                                        
                                        |           *                                                                                                           
                                        |                *                                                                                                      
                                        |               *                                                                                                       
                                        |           *                                                                                                           
                                        |        *                                                                                                              
                                        |           *                                                                                                           
                                        |             *                                                                                                         
                                        |            *                                                                                                          
                                        |                 *                                                                                                     
                                        |             *                                                                                                         
                                        |                 *                                                                                                     
                                        |                *                                                                                                      
                                        |           *                                                                                                           
                                        |             *                                                                                                         
                                        |         *                                                                                                             
                                        |    *                                                                                                                  
                                        |   *                                                                                                                   
                                        |    *                                                                                                                  
                                        |  *                                                                                                                    
                                        |  *                                                                                                                    
                                        |      *                                                                                                                
                                        |       *                                                                                                               
                                        |    *                                                                                                                  
                                        |      *                                                                                                                
                                        |      *                                                                                                                
                                        |      *                                                                                                                
                                        |    *                                                                                                                  
                                        | *                                                                                                                     
                                        |     *                                                                                                                 
                                        |   *                                                                                                                   
                                        |      *                                                                                                                
                                        |   *                                                                                                                   
                                        | *                                                                                                                     
                                        |*                                                                                                                      
                                       *|                                                                                                                       
                                      * |                                                                                                                       
                                    *   |                                                                                                                       
                                       *|                                                                                                                       
                                        | *                                                                                                                     
                                        *                                                                                                                       
                                    *   |                                                                                                                       
                                      * |                                                                                                                       
                                       *|                                                                                                                       
                                    *   |                                                                                                                       
                                   *    |                                                                                                                       
                                     *  |                                                                                                                       
                                  *     |                                                                                                                       
                                    *   |                                                                                                                       
                                   *    |                                                                                                                       
                                   *    |                                                                                                                       
                                 *      |                                                                                                                       
                                *       |                                                                                                                       
                             *          |                                                                                                                       
                             *          |                                                                                                                       
                           *            |                                                                                                                       
                           *            |                                                                                                                       
                             *          |                                                                                                                       
                             *          |                                                                                                                       
                              *         |                                                                                                                       
                                *       |                                                                                                                       
                                  *     |                                                                                                                       
                                  *     |                                                                                                                       
                                      * |                                                                                                                       
                                  *     |                                                                                                                       
                                     *  |                                                                                                                       
                                   *    |                                                                                                                       
                                   *    |                                                                                                                       
                                 *      |                                                                                                                       
                              *         |                                                                                                                       
                             *          |                                                                                                                       
                            *           |                                                                                                                       
                           *            |                                                                                                                       
                              *         |                                                                                                                       
                           *            |                                                                                                                       
                          *             |                                                                                                                       
                         *              |                                                                                                                       
                           *            |                                                                                                                       
                           *            |                                                                                                                       
                         *              |                                                                                                                       
                        *               |                                                                                                                       
                          *             |                                                                                                                       
                          *             |                                                                                                                       
                          *             |                                                                                                                       
                       *                |                                                                                                                       
                         *              |                                                                                                                       
                         *              |                                                                                                                       
                          *             |                                                                                                                       
                           *            |                                                                                                                       
                         *              |                                                                                                                       
                       *                |                                                                                                                       
                        *               |                                                                                                                       
                          *             |                                                                                                                       
                           *            |                                                                                                                       
                            *           |                                                                                                                       
                              *         |                                                                                                                       
                                *       |                                                                                                                       
                                   *    |                                                                                                                       
                                 *      |                                                                                                                       
                                    *   |                                                                                                                       
                                 *      |                                                                                                                       
                                  *     |                                                                                                                       
                                *       |                                                                                                                       
                               *        |                                                                                                                       
                                *       |                                                                                                                       
                              *         |                                                                                                                       
                                *       |                                                                                                                       
                                   *    |                                                                                                                       
                                *       |                                                                                                                       
                              *         |                                                                                                                       
                            *           |                                                                                                                       
                           *            |                                                                                                                       
                         *              |                                                                                                                       
                          *             |                                                                                                                       
                           *            |                                                                                                                       
                         *              |                                                                                                                       
                          *             |                                                                                                                       
                         *              |                                                                                                                       
                          *             |                                                                                                                       
                          *             |                                                                                                                       
                        *               |                                                                                                                       
                           *            |                                                                                                                       
                         *              |                                                                                                                       
                       *                |                                                                                                                       
                        *               |                                                                                                                       
                          *             |                                                                                                                       
                            *           |                                                                                                                       
                            *           |                                                                                                                       
                              *         |                                                                                                                       
                           *            |                                                                                                                       
                           *            |                                                                                                                       
                              *         |                                                                                                                       
                               *        |                                                                                                                       
                                *       |