Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <stdio.h>
- # include <conio.h>
- # include <iostream>
- # include "stdafx.h"
- using namespace std;
- int main()
- {
- char str[80];
- int sum = 0,i=0;
- gets(str);
- while (str[i] && str[i] != '\n')
- {
- if (str[i] >= '0' && str[i] <= '9')
- sum += str[i] - '0';
- i++;
- }
- cout << "Sum =" << sum;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement