Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include <stdlib.h>
- void main()
- {
- char ch1[30],ch1n[30];
- char ch2[30],ch2n[30];
- int k,i;
- printf("ch1=");
- scanf("%s",&ch1);
- printf("\n ch2=");
- scanf("%s",&ch2);
- k=0;
- ch1n[0] = '\0';
- for(i=0;i<strlen(ch1);i++)
- {
- if(ch1[i]>='0' && ch1[i]<='9')
- {
- ch1n[k]=ch1[i];
- k++;
- }
- }
- k=0;
- ch2n[0] = '\0';
- for(i=0;i<strlen(ch2);i++)
- {
- if(ch2[i]>='0' && ch2[i]<='9')
- {
- ch2n[k]=ch2[i];
- k++;
- }
- }
- printf("la somme des chiffres dans le deux chaines est: %d",atoi(ch1n)+atoi(ch2n));
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement