1 solutions
-
0
C :
#include<stdio.h> void main(){ int peachs=1; for(int i=1; i<10; i++) peachs=(peachs+1)*2; printf("%d",peachs); }C++ :
#include <iostream> using namespace std; int main(){ int i,n = 1; for(i = 1;i <= 9;i++) { n = (n + 1) * 2; } cout<<n<<endl; return 0; }Pascal :
var i,n:integer; begin i := 9; n := 1; while i > 0 do begin n := 2 * (n + 1); i := i - 1; end; writeln(n); readln; end.Java :
public class Main { public static void main(String[] args) { int n=1; for(int i =10;i>1;i--){ n=(n+1)*2; } System.out.println(n); } }Python :
n = 1 for i in range (9 , 0 , -1): n = (n + 1) * 2 i -= 1 if i == 0: print(n)
- 1
Information
- ID
- 1270
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- 10
- Tags
- # Submissions
- 6
- Accepted
- 5
- Uploaded By