Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Apostila de C
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
PET Computação
Apostila de C
Commits
c9773121
Commit
c9773121
authored
Apr 28, 2015
by
João Denis Rodrigues
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adicionado exemplos de break e switch
parent
30f4e096
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
exemplos/break.c
exemplos/break.c
+12
-0
exemplos/switch.c
exemplos/switch.c
+18
-0
No files found.
exemplos/break.c
0 → 100644
View file @
c9773121
#include <stdio.h>
void
main
()
{
int
contagem
;
for
(
contagem
=
0
;
contagem
<
10
;
contagem
++
)
{
if
(
contagem
==
5
)
/* quando contagem for 5 */
break
;
/* interrompe o loop */
printf
(
"%d "
,
contagem
);
}
printf
(
"
\n
"
);
}
exemplos/switch.c
0 → 100644
View file @
c9773121
#include <stdio.h>
#include <stdlib.h>
void
main
()
{
char
vogal
;
printf
(
"Digite uma vogal: "
);
scanf
(
"%c"
,
&
vogal
);
/* le uma letra */
switch
(
vogal
)
{
case
'a'
:
vogal
=
'e'
;
break
;
case
'e'
:
vogal
=
'i'
;
break
;
case
'i'
:
vogal
=
'o'
;
break
;
case
'o'
:
vogal
=
'u'
;
break
;
case
'u'
:
vogal
=
'a'
;
break
;
default:
printf
(
"Erro!A letra nao e vogal
\n
"
);
exit
(
0
);
};
printf
(
"a vogal subsequente e %c
\n
"
,
vogal
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment