initial import
[staff/goc4/2018bti7061.git] / c-2-controlStructures / examples / controlStatements / breaks.c
1 #include <stdio.h>
2
3 main(){
4 puts("--------------------------");
5 puts("Examples with BREAK");
6
7 int val, exponent;
8
9 int i=0;
10 int res = 1;
11
12 puts("type value and exponent:");
13 scanf(" %d %d",&val,&exponent);
14
15 while(1){
16 if(i++ == exponent){
17 break;
18 }
19 res *= val;
20
21 }
22 printf("%d power %d = %d\n",val,exponent,res);
23
24 }