With the following codes
\documentclass[12pt,a4paper]{article}
\usepackage{amsfonts,amsmath,amssymb,graphicx}
\usepackage{tikz,tkz-tab,moreverb} % tableau de signe moreverb not needed
\usetikzlibrary{arrows}
\usepackage[francais]{babel}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
\usepackage[latin1]{inputenc}
\usepackage{verbatim}
\usepackage{color}
\usepackage[final]{pdfpages} %pour inserer une page pdf
\usepackage{fancyhdr} % pagestyle
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}
%\usepackage{setspace}
%\onehalfspacing
%---- Structure Exercice -----
\newtheorem{Exc}{Exercice}
\def\exo#1{\futurelet\testchar\MaybeOptArgmyexoo}
\def\MaybeOptArgmyexoo{\ifx[\testchar \let\next\OptArgmyexoo
\else \let\next\NoOptArgmyexoo \fi \next}
\def\OptArgmyexoo[#1]{\begin{Exc}[#1]\normalfont}
\def\NoOptArgmyexoo{\begin{Exc}\normalfont}
\newcommand{\finexo}{\end{Exc}}
\newcommand{\flag}[1]{}
%%%%%%%%%%%%%%%% debut exercice %%%%%%%%%%%%%%%%%%%
%\exo{{}}:\\
%\finexo
%%%%%%%%%%%%%%%% fin exercice %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{sfaxlogo}{RGB}{127,176,206}
\colorlet{sfaxblue}{sfaxlogo!70!black!60!blue}
\begin{document}
%%%%%%%%%%%%%%%% debut exercice %%%%%%%%%%%%%%%%%%%
\exo{{}}:
\finexo
%%%%%%%%%%%%%%%% fin exercice %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% debut exercice %%%%%%%%%%%%%%%%%%%
\exo{{}}:
\finexo
%%%%%%%%%%%%%%%% fin exercice %%%%%%%%%%%%%%%%%%%
\end{document}
I get
How can get the exercises with the following form



\newtheorem:\newtheorem*{Exc}{\shadowbox{Exercice \arabic{counter}\optionaltext}\\}– Plant Oct 05 '20 at 19:51\exo{} \begin{itemize} \item [(1)] \item [(2)] \item [(3)] \end{itemize} \finexo, I will not obtain a new line. I hope to help me. Thanks – Schüler Oct 06 '20 at 07:28\exo, a hacky fix is\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont $\:$}, (and no new line at the end of\newtheorem). There may be a more "correct" way but that should work. – Plant Oct 06 '20 at 17:17