FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Create GP program java by Siddhartha05 · Pull Request #833 · seeditsolution/pythonprogram · GitHub

Repository navigation

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension No extension  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 19 additions & 0 deletions GP program java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class GP {
static void printGP(int a, int r, int n)
{
int curr_term;
for (int i = 0; i < n; i++) {
curr_term = a * (int)Math.pow(r, i);
System.out.print(curr_term + " ");
}
}

// Driver code
public static void main(String[] args)
{
int a = 2; // starting number
int r = 3; // Common ratio
int n = 5; // N th term to be find
printGP(a, r, n);
}
}

Back | FazBrowse Home | New Git URL