From d89189a5d16115e2f9a570504a00763da08e6542 Mon Sep 17 00:00:00 2001 From: Ashish Agarwal Date: Fri, 16 Jun 2017 16:47:35 +0530 Subject: [PATCH 1/2] floyd triangle --- .DS_Store | Bin 8196 -> 8196 bytes ft.java | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 ft.java diff --git a/.DS_Store b/.DS_Store index dd05b9be5a8cdaa608a8a520040e4f99e574da1b..27875fa6e0825fbffd3779ceb1765c6599a40067 100644 GIT binary patch delta 104 zcmZp1XmOa}&nUDpU^hRb&}JTiR3>J2hP25ILJ}PRpNmD diff --git a/ft.java b/ft.java new file mode 100644 index 000000000000..843f4a559bde --- /dev/null +++ b/ft.java @@ -0,0 +1,19 @@ +import java.util.Scanner; + class FloydTriangle + { + public static void main(String[] args) + { +Scanner sc = new Scanner(System.in); +System.out.println("Enter the number of rows which you want in your Floyd Triangle: "); +int r = sc.nextInt(); +int n=0; +for(int i=0; i<r; i++) +{ +for(int j=0; j<=i; j++) +{ +System.out.print(++n+" "); +} +System.out.println(); +} +} +} \ No newline at end of file From b8d98f933708f1b5fa66f875bc5857af80b95e6c Mon Sep 17 00:00:00 2001 From: Ashish Agarwal Date: Fri, 16 Jun 2017 17:05:39 +0530 Subject: [PATCH 2/2] krishnamurthy --- krishnamurthy.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 krishnamurthy.java diff --git a/krishnamurthy.java b/krishnamurthy.java new file mode 100644 index 000000000000..f8137513dc2b --- /dev/null +++ b/krishnamurthy.java @@ -0,0 +1,29 @@ +import java.util.Scanner; +class krishnamurthy +{ + int fact(int n) + { + int i,p=1; + for(i=n;i>=1;i--) + p=p*i; + return p; + } + public static void main(String args[]) + { + Scanner sc=new Scanner(System.in); + int a,b,s=0; + System.out.print("Enter the number : "); + a=sc.nextInt(); + int n=a; + while(a>0) + { + b=a%10; + s=s+fact(b); + a=a/10; + } + if(s==n) + System.out.print(n+" is a krishnamurthy number"); + else + System.out.print(n+" is not a krishnamurthy number"); + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy