Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 3я:
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, count = 0;
- scanf("%d", &n);
- if (n == 0){
- n++;
- }
- while (n != 0){
- count++;
- n = n / 10;
- }
- if (count == 3){
- printf("Da, tri cifri");
- }
- }
- 4я:
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, sum = 0;
- scanf("%d", &n);
- while (n != 0){
- sum += n % 10;
- n = n / 10;
- }
- cout << sum << endl;
- }
- 5я:
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int n, current, last = 0, k = 0;
- cin >> n;
- while (n != 0){
- current = n % 10;
- if (current == last){
- cout << "Da" << endl;
- k = 1;
- break;
- }
- last = current;
- n = n / 10;
- }
- if (k == 0){
- cout << "Net" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement