I have to be at the end of each example, sign the box. However, in various situations, it appears in some other places. I would like that it was always in the same place. I wish that was on the right side in the last line. As in the first example. I do not want to was lower as in the example of the second and third. When the example ends the text is well. However, when the ends using array or equation is below. I do not know how to change it. It is very important to me.
\documentclass[12pt,a4paper,twoside]{book}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm, amssymb}
\usepackage[polish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{latexsym}
\usepackage[nottoc]{tocbibind}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{dsfont}
\usepackage{stackrel}
\usepackage{etoolbox}
\usepackage{listingsutf8}
\usepackage{ucs}
\usepackage{url}
\textwidth 15.3cm
\textheight 22.2cm
\topmargin 0cm
\oddsidemargin 0.55cm
\evensidemargin 0cm
\fancypagestyle{number}{
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\newtheoremstyle{stylexample}% name
{}% Space above, empty = `usual value'
{}% Space below
{\normalfont}% Body font e.g. \normalfont \bfseries \itshape
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}% Thm head spec
\theoremstyle{stylzad}
\newtheorem{example}[chapter]{Example}
\AtEndEnvironment{example}{\null\hfill\qedsymbol}
\begin{document}
\thispagestyle{number}\chapter{Number}
\begin{example}
During the 19th century, mathematicians began to develop many different abstractions which share certain properties of numbers and may be seen as extending the concept. Among the first were the hypercomplex numbers, which consist of various extensions or modifications of the complex number system. Today, number systems are considered important special examples of much more general categories such as rings and fields, and the application of the term "number" is a matter of convention, without fundamental significance.
\end{example}
\begin{example}
$$
\begin{array}{c}
abc:\\
a \\
b \\
c .\\
\end{array}$$\end{example}
\begin{example}
\begin{equation} \nonumber
2+3=5
\end{equation}
\end{example}
\end{document}

\qedhere. – Matsmath Jun 02 '16 at 15:45(-;– ebosi Jun 02 '16 at 15:47ntheoreminstead ofamsthm, this would be automatic. Comment aside; don't use$$…$$, which plain TeX code for displayed equations. Replace it with\[ … \]. – Bernard Jun 02 '16 at 16:03