cavaman

Untitled

Oct 3rd, 2021
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.74 KB | None | 0 0
  1. package com.example.lab1
  2.  
  3. import androidx.appcompat.app.AppCompatActivity
  4. import android.os.Bundle
  5. import android.widget.TextView
  6.  
  7. class MainActivity : AppCompatActivity() {
  8.     override fun onCreate(savedInstanceState: Bundle?) {
  9.         super.onCreate(savedInstanceState)
  10.         setContentView(R.layout.activity_main)
  11.         var textView: TextView
  12.         val result: TextView
  13.  
  14.         val x=3
  15.  
  16.         textView = findViewById(R.id.textView)
  17.         result = findViewById(R.id.result)
  18.         textView.text = x.toString()
  19.  
  20.  
  21.         while(n<8)
  22.         {
  23.             val a=a*(x-2.pow(n))
  24.             val b=b*(x-(2.pow(n)-1))
  25.             val n=n+1
  26.         }
  27.         val res=a/b
  28.  
  29.         result.text = res.toString()
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment