Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Untitled
SUBMITTED BY:
Guest
DATE:
Sept. 30, 2014, 10:18 p.m.
FORMAT:
C++
SIZE:
509 Bytes
Raw
Download
Tweet
HITS:
1530
Go to comments
Report
#include
<stdio.h>
#define N 16
// don't forget to account for the \0 at the end
void
main
()
{
char
string
[
N
];
int
i
,
sum
=
0
;
printf
(
"Write a sentence with . between words:
\n
"
);
scanf
(
"%s"
,
string
);
for
(
i
=
0
;
i
<
N
-1
;
i
++
)
{
if
(
string
[
i
]
==
'.'
)
{
printf
(
"The geometria is %d
\n
"
,
sum
);
sum
=
0
;
}
else
{
sum
+=
(
int
)
string
[
i
];
}
}
printf
(
"The geometria is %d"
,
sum
);
getch
();
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus