There are 22 grams of fat and each gram of fat is 9 calories, then
[tex]22\text{ grams }\cdot9\frac{calories}{gram}=198\text{ calories from fat}[/tex]945 calories represents 100%, then 198 represents:
[tex]\begin{gathered} \frac{945\text{ calories}}{198\text{ calories}}=\frac{100\text{ \%}}{x\text{ \%}} \\ 945\cdot x=100\cdot198 \\ x=\frac{19800}{945} \\ x=21\text{ \%} \end{gathered}[/tex]21% of the calories are from g