Joao_Joao

Questão 24 Lista de Exercícios IFPB

Apr 29th, 2022 (edited)
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.   int termo_inicial, razao;
  5.   printf("Informe o termo inicial da PA: ");
  6.   scanf("%d", &termo_inicial);
  7.   printf("Informe a razao da PA: ");
  8.   scanf("%d", &razao);
  9.  
  10.   printf("1º Termo: %d\n", termo_inicial); // N
  11.   printf("2º Termo: %d\n", termo_inicial += razao); // N + R
  12.   printf("3º Termo: %d\n", termo_inicial += razao); // N + R * 2
  13.   printf("4º Termo: %d\n", termo_inicial += razao); // N + R * 3
  14.   printf("5º Termo: %d\n", termo_inicial += razao); // N + R * 4
  15.  
  16.   /*
  17.     "termo_inicial += razao"
  18.     eh a mesma coisa que:
  19.     "termo_inicial = termo_inicial + razao"
  20.   */
  21.  
  22.   return 0;
  23. }
  24.  
Add Comment
Please, Sign In to add comment