Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int MaxBroj (char *s) {
- int broj=0, max_broj=-1000;
- char *poc=s, *p_broja;
- while (*s!='\0') {
- if (*s>='0' && *s<='9') {
- p_broja=s;
- while (*s>='0' && *s<='9') {
- broj=broj*10+(*s-'0');
- s++;
- }
- if (*(p_broja-1)=='-') broj*=-1;
- if (broj>max_broj) max_broj=broj;
- broj=0;
- }
- s++;
- }
- return max_broj;
- }
- int main () {
- char s[]="Ovo j-2e re-23cen-456ica";
- printf("%d",MaxBroj(s));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement