diff --git a/.DS_Store b/.DS_Store index dd05b9be5a8c..27875fa6e082 100644 Binary files a/.DS_Store and b/.DS_Store differ 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 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