Advertisement
hercioneto

Programa C Exemplo Função

Oct 18th, 2023 (edited)
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3.  
  4. int somar(int n1, int n2, int n3) {
  5.     printf("\n Oi vim somar\n");
  6.     int soma;
  7.     soma = n1+n2+n3;
  8.     return soma;
  9. }
  10.  
  11. void main() {
  12.     // Write C code here
  13.     int numero1,numero2,numero3, resultado;
  14.     printf("Informe o primeiro numero: ");
  15.     scanf("%i",&numero1);
  16.    
  17.     printf("Informe o primeiro numero: ");
  18.     scanf("%i",&numero2);
  19.    
  20.     printf("Informe o primeiro numero: ");
  21.     scanf("%i",&numero3);
  22.    
  23.     resultado = somar(numero1,numero2,numero3);
  24.    
  25.     printf("O resultado deu: %i",resultado);
  26.  
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement