Solução: Dobradura - OBI (Delson Rosario)

From AdonaiMedrado.Pro.Br
Revision as of 12:36, 29 April 2009 by 200.17.147.2 (Talk) (New page: <code> #include <stdio.h> main(){ int entrada,teste=1,saida,base,i,aux; scanf("%d",&entrada); while(entrada != -1){ base = 2; aux = 1; for(i=1;i<=en...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

#include <stdio.h>

main(){

   int entrada,teste=1,saida,base,i,aux;
   scanf("%d",&entrada);
   while(entrada != -1){
        base = 2;
        aux = 1;
        for(i=1;i<=entrada;i++){
           base += aux;
           aux *= 2;
        }
        printf("Teste %d\n",teste);
        printf("%d\n",base*base);
        teste++;
        scanf("%d",&entrada);
   }

}