C Programming


Compiling C# code at runtime

Occasionally we might come across a problem which lends itself well to the idea of C# code being compiled at runtime. The .NET Framework includes a mechanism called the Code Document Object Model (CodeDOM) that enables developers of programs that emit source code to generate source code in multiple programming languages at run time, based on a single model that represents the code to render. We can use the CSharpCodeProvider to do exactly this, it can compile…

The problem of “Beautiful Arrays” with C Source code

An array $latex a $ is called beautiful if for every pair of numbers $latex a_i $, $latex a_j $, ($latex i \neq j $), there exists an $latex a_k $ such that $latex a_k = a_i * a_j $. Note that $latex k $ can be equal to $latex i $ or $latex j $ too. Input First line of the input contains an integer T denoting the number of test cases. T test cases…