Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. 3я:
  2.  
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n, count = 0;
  10. scanf("%d", &n);
  11. if (n == 0){
  12. n++;
  13. }
  14. while (n != 0){
  15. count++;
  16. n = n / 10;
  17. }
  18. if (count == 3){
  19. printf("Da, tri cifri");
  20. }
  21. }
  22.  
  23. 4я:
  24.  
  25. #include <iostream>
  26.  
  27. using namespace std;
  28.  
  29. int main()
  30. {
  31. int n, sum = 0;
  32. scanf("%d", &n);
  33. while (n != 0){
  34. sum += n % 10;
  35. n = n / 10;
  36. }
  37. cout << sum << endl;
  38. }
  39.  
  40.  
  41. 5я:
  42.  
  43. #include <iostream>
  44. #include <string>
  45.  
  46. using namespace std;
  47.  
  48. int main()
  49. {
  50. int n, current, last = 0, k = 0;
  51. cin >> n;
  52. while (n != 0){
  53. current = n % 10;
  54. if (current == last){
  55. cout << "Da" << endl;
  56. k = 1;
  57. break;
  58. }
  59. last = current;
  60. n = n / 10;
  61. }
  62. if (k == 0){
  63. cout << "Net" << endl;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement