Professional Documents
Culture Documents
converted by W eb2PDFConvert.com
1. import java.util.Scanner;
2. public class Upper_Triangular
3. {
4. public static void main(String args[])
5. {
6. int a[][] = new int[5][5];
7. System.out.println("Enter the order of your Matrics ");
8. System.out.println("Enter the rows:");
9. Scanner sc = new Scanner(System.in);
10. int n = sc.nextInt();
11. System.out.println("Enter the columns:");
12. Scanner s = new Scanner(System.in);
13. int m = s.nextInt();
14.
15. if(n == m)
16. {
17. System.out.println("Enter your elements:");
18. for(int i = 0; i < n; i++)
19. {
20. for(int j = 0; j < n; j++)
21. {
22. Scanner ss = new Scanner(System.in);
23. a[i][j] = ss.nextInt();
24. System.out.print(" ");
25. }
26. }
27. System.out.println("You have entered:");
28. for(int i = 0; i < n; i++)
29. {
30. for(int j = 0; j < n; j++)
31. {
32. System.out.print(a[i][j] + " ");
33. }
34. System.out.println("");
35. }
36. System.out.println("The Upper Triangular Matrices is:");
37. for(int i = 0; i < n; i++)
38. {
39. for(int j = 0; j < n; j++)
40. {
41. if(i <= j)
42. {
43. System.out.print(a[i][j] +" ");
44. }
45. else
46. {
47. System.out.print("0"+" ");
48. }
49. }
50. System.out.println("");
51. }
52. }
53. else
54. {
55. System.out.println("you have entered improper order");
56. }
57. }
58. }
59. }
Output:
converted by W eb2PDFConvert.com
$ javac Upper_Triangular.java
$ java Upper_Triangular
converted by W eb2PDFConvert.com
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He
is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas.
He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux
Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C
Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel.
Stay connected with him below:
LinkedIn | Facebook | Twitter | Google+
Name*
Email*
Best Careers
Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of
almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs,
Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi,
Tata VSNL, Mindtree, Cognizant and Startups.
Best Trainings
SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers
converted by W eb2PDFConvert.com
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books
India Internships
About Sanfoundry
About Us
Copyright
TOS & Privacy
Jobs
Bangalore Training
Online Training
SAN Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
2011-2017 Sanfoundry
converted by W eb2PDFConvert.com