# What solution do you suggest to convert C code to Tex? [closed]

I try to generate the output loop instead of writing the output. What solution do you have for this code? Thanks for any help.

\documentclass{article}
\usepackage{listings}

\begin{document}
\begin{lstlisting}[language=C]
#include <stdio.h>
main()
{int i,j;
for(i=1;i<=5;i++){for(j=(6-i);j>=1;j--)
printf("%d",j);
printf("\n");}
return 0;}
\end{lstlisting}

Automatically convert C code to text. Output as follows:
\\
5 4 3 2 1\\
4 3 2 1 \\
3 2 1\\
2 1\\
1

\end{document}


Output:

## closed as too broad by Stefan Pinnow, Cragfelt, BambOo, Tiuri, dgoodmaniiiNov 8 at 21:33

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Your solution does not use fpu. What is more important is to clarify what you want to achieve. It sounds like you want to convert arbitrary C code to LaTeX, which is in general not feasible AFAIK. – Schrödinger's cat Nov 8 at 14:09
• I searched a lot to find nothing to convert. With the many packages I said, maybe a pack would make my job easier. Thanks. I'm waiting for a good idea. Because the number of applications takes too long to convert. – M.Ahmadi Nov 8 at 14:28
• Can't you just include the output that the codes generated (perhaps along with their listings)? – Schrödinger's cat Nov 8 at 14:31
• No, my goal is to produce output with Tex. – M.Ahmadi Nov 8 at 14:36
• But then you will find undoubtedly C codes which cannot be recast into LaTeX. Your example is neat, but this a simple thingy that can be done with LaTeX. Some more complex C codes cannot be rewritten in LaTeX, I am afraid. – Schrödinger's cat Nov 8 at 14:38