Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int sumarDosNumerosFuncion(int numero1, int numero2) {
  5. int suma;
  6. suma = numero1 + numero2;
  7.  
  8. return suma;
  9. }
  10.  
  11. void sumarDosNumerosMetodo(int numero1, int numero2) {
  12.  
  13. int resultado;
  14.  
  15. resultado = numero1 + numero2;
  16.  
  17. printf("El resultado del metodo es: %i\n", resultado);
  18.  
  19. }
  20.  
  21.  
  22. void dibujarTriangulo(int n) {
  23.  
  24. int espacios = n - 1;
  25. int asteriscos = 1;
  26. int i, j, m;
  27.  
  28. for(i = 1; i <= n; i++) {
  29.  
  30. for(j = 1; j <= espacios; j++) {
  31. printf(" ");
  32. }
  33.  
  34. for(j = 1; j <= asteriscos; j++) {
  35. printf("*");
  36. }
  37.  
  38. printf("\n");
  39. espacios--;
  40. asteriscos++;
  41. }
  42.  
  43. printf("\n");
  44. }
  45. int main()
  46. {
  47. // int a = 10;
  48. // int b = 20;
  49.  
  50. // int resultado;
  51.  
  52.  
  53. // bool caracter;
  54.  
  55.  
  56. // resultado = sumarDosNumerosFuncion(a, b);
  57. // sumarDosNumerosMetodo(a, b);
  58. // printf("El resultado de la funcion es: %i\n", resultado);
  59.  
  60. dibujarTriangulo(5);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement