Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. // Questão 1
  2.  
  3. /*int fibonacci (int* n[])
  4. {
  5. int x,y,a=0,b=1,c=0;
  6. scanf("%d", &x);
  7. malloc(sizeof(x * int))
  8. for (int i = 0; i < x; i++)
  9. {
  10. for(y=1; y<x; y++)
  11. {
  12. if(y%2==1)
  13. {
  14. n[i] = c;
  15. c=a+b;
  16. a=c;
  17. }
  18. else if(y==2)
  19. n[i] = c
  20. else if(y%2==0)
  21. {
  22. n[i] = c;
  23. c=a+b;
  24. b=c;
  25. }
  26. }
  27. }
  28. return n[]
  29. }
  30. */
  31.  
  32. // Questão 2
  33.  
  34. /*#include <stdio.h>
  35. #include <stdlib.h>
  36.  
  37. int main (void)
  38. {
  39. long int x, y, i;
  40. double fx = 1, fn = 1, s;
  41. while (scanf("%ld %ld", &M, &N) != EOF)
  42. {
  43. for (i=x; i>=1; i--)
  44. fx *= i;
  45. for (i=y; i>=1; i--)
  46. fy *= i;
  47. s = fx + fy;
  48. printf ("%.0f\n", s);
  49. fx = fy = 1;
  50. }
  51. return 0;
  52. }*/
  53.  
  54.  
  55. // Questão 3
  56.  
  57. /*#include <stdio.h>
  58. #include <math.h>
  59.  
  60. int prime(int x)
  61. {
  62. int i, r;
  63. if(x<2)
  64. return 0;
  65. if(x==2)
  66. return 1;
  67. if(x%2==0)
  68. return 0;
  69. r=sqrt(x);
  70. for(i=3; i<=r; i=i+2)
  71. {
  72. if(x%i==0)
  73. return 0;
  74. }
  75. return 1;
  76. }
  77. int main()
  78. {
  79. int a,b,c;
  80. scanf("%d", &c);
  81. for(a=1;b<=c;b++)
  82. {
  83. scanf("%d", &a);
  84. if(1==prime(a))
  85. printf("%d - Primo\n", a);
  86. else if(0==prime(a))
  87. printf("%d - Nao Primo\n", a);
  88. }
  89. return 0;
  90. }
  91. */
  92.  
  93.  
  94. // Questão 4
  95.  
  96. /*#include <stdio.h>
  97.  
  98. int main()
  99. {
  100. int n,x;
  101. char cesar[50];
  102.  
  103. scanf("%d",&n);
  104. for(int i = 0; i < n; i++)
  105. {
  106. scanf("%s",&cesar);
  107. scanf("%d",&x);
  108.  
  109. for(int j = 0; j < 50; j++)
  110. {
  111. if(cesar[j] == '\0') break;
  112. if((cesar[j] - x) < 65) printf("%c", (cesar[j] - x)+ 26);
  113. else printf("%c", (cesar[j] - x));
  114. }
  115. }
  116. return 0;
  117. }*/
  118.  
  119. // Questão 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement