diff --git a/C/program-1/a.out b/C/program-1/a.out deleted file mode 100755 index 3448b52e..00000000 Binary files a/C/program-1/a.out and /dev/null differ diff --git a/C/program-15/a.out b/C/program-15/a.out deleted file mode 100755 index e9bd45dd..00000000 Binary files a/C/program-15/a.out and /dev/null differ diff --git a/C/program-16/.vscode/launch.json b/C/program-16/.vscode/launch.json deleted file mode 100644 index c3a20dda..00000000 --- a/C/program-16/.vscode/launch.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - { - "name": "(gdb) Attach", - "type": "cppdbg", - "request": "attach", - "program": "enter program name, for example ${workspaceFolder}/a.out", - "processId": "${command:pickProcess}", - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "gcc build and debug active file", - "type": "cppdbg", - "request": "launch", - "program": "${fileDirname}/${fileBasenameNoExtension}", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "gcc build active file", - "miDebuggerPath": "/usr/bin/gdb" - } - ] -} \ No newline at end of file diff --git a/C/program-16/a.out b/C/program-16/a.out deleted file mode 100755 index d58aae3f..00000000 Binary files a/C/program-16/a.out and /dev/null differ diff --git a/C/program-17/a.out b/C/program-17/a.out deleted file mode 100755 index 7d2df0d4..00000000 Binary files a/C/program-17/a.out and /dev/null differ diff --git a/C/program-18/program.c b/C/program-18/program.c index 1111cbfb..f229ef42 100644 --- a/C/program-18/program.c +++ b/C/program-18/program.c @@ -13,8 +13,8 @@ int main() c=c+(a*a*a); } if(temp==c) - printf("armstrong number"); + printf("armstrong number\n"); else - println("Not armstrong number"); + printf("Not armstrong number\n"); return 0; } diff --git a/C/program-19/a.out b/C/program-19/a.out deleted file mode 100755 index 2844dfd8..00000000 Binary files a/C/program-19/a.out and /dev/null differ diff --git a/C/program-20/a.out b/C/program-20/a.out deleted file mode 100755 index 5d53f3ee..00000000 Binary files a/C/program-20/a.out and /dev/null differ diff --git a/C/program-21/a.out b/C/program-21/a.out deleted file mode 100755 index 241d921c..00000000 Binary files a/C/program-21/a.out and /dev/null differ diff --git a/C/program-22/a.out b/C/program-22/a.out deleted file mode 100755 index c9555c14..00000000 Binary files a/C/program-22/a.out and /dev/null differ diff --git a/C/program-23/a.out b/C/program-23/a.out deleted file mode 100755 index 99981a39..00000000 Binary files a/C/program-23/a.out and /dev/null differ diff --git a/C/program-24/a.out b/C/program-24/a.out deleted file mode 100755 index d8f80262..00000000 Binary files a/C/program-24/a.out and /dev/null differ diff --git a/C/program-25/a.out b/C/program-25/a.out deleted file mode 100755 index 83930e91..00000000 Binary files a/C/program-25/a.out and /dev/null differ diff --git a/C/program-26/a.out b/C/program-26/a.out deleted file mode 100755 index 8a517270..00000000 Binary files a/C/program-26/a.out and /dev/null differ diff --git a/C/program-27/a.out b/C/program-27/a.out deleted file mode 100755 index 447dbe46..00000000 Binary files a/C/program-27/a.out and /dev/null differ diff --git a/C/program-28/a.out b/C/program-28/a.out deleted file mode 100755 index b78b3ff4..00000000 Binary files a/C/program-28/a.out and /dev/null differ diff --git a/C/program-29/a.out b/C/program-29/a.out deleted file mode 100755 index fa643187..00000000 Binary files a/C/program-29/a.out and /dev/null differ diff --git a/C/program-30/a.out b/C/program-30/a.out deleted file mode 100755 index db007813..00000000 Binary files a/C/program-30/a.out and /dev/null differ diff --git a/C/program-31/a.out b/C/program-31/a.out deleted file mode 100755 index 22b5b248..00000000 Binary files a/C/program-31/a.out and /dev/null differ diff --git a/C/program-31/program.c b/C/program-31/program.c index 43a5fffb..c5dc115d 100644 --- a/C/program-31/program.c +++ b/C/program-31/program.c @@ -14,9 +14,9 @@ int main() { printf("Enter the details of student - %d\n",i); printf("Enter the name of the student\n"); - scanf("%s",&stud[i].n); + scanf("%s",stud[i].n); printf("Enter USN\n"); - scanf("%s",&stud[i].u); + scanf("%s",stud[i].u); printf("Enter total marks\n"); scanf("%d",&stud[i].m); } @@ -27,9 +27,9 @@ int main() } printf("Enter the details of new student\n"); printf("Enter the name\n"); //preferred to enter equal length of name - scanf("%s",&stud2.n); + scanf("%s",stud2.n); printf("Enter the USN\n"); - scanf("%s",&stud2.u); + scanf("%s",stud2.u); printf("Enter the marks\n"); scanf("%d",&stud2.m); printf("enter position\n"); diff --git a/C/program-32/program.c b/C/program-32/program.c index 26b3f3e9..ca73dc86 100644 --- a/C/program-32/program.c +++ b/C/program-32/program.c @@ -7,16 +7,16 @@ int m; }stud[10],stud2; int main() { - int n,i,p=0; + int n,i=0; printf("Enter the number of student\n"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("Enter the details of student - %d\n",i); printf("Enter the name of the student\n"); - scanf("%s",&stud[i].n); + scanf("%s",stud[i].n); printf("Enter USN\n"); - scanf("%s",&stud[i].u); + scanf("%s",stud[i].u); printf("Enter total marks\n"); scanf("%d",&stud[i].m); } diff --git a/C/program-33/program.c b/C/program-33/program.c index 80f7131f..6ca274d2 100644 --- a/C/program-33/program.c +++ b/C/program-33/program.c @@ -1,6 +1,7 @@ /* Arithematic operation using pointers */ #include -void main() +#include +int main() { int a,b; int *x,*y; @@ -9,6 +10,6 @@ x=&a; y=&b; //s=; printf("%d\t%d",*x+*y,abs(*x-*y)); - +return 0; } diff --git a/C/program-37/a.out b/C/program-37/a.out deleted file mode 100755 index 2dff926d..00000000 Binary files a/C/program-37/a.out and /dev/null differ diff --git a/C/program-37/program.c b/C/program-37/program.c index 0f2f59a1..6be02495 100644 --- a/C/program-37/program.c +++ b/C/program-37/program.c @@ -11,15 +11,13 @@ int f; if(n==0 || n==1) { - - return ; + return 1; } else { f=fib(n-2)+fib(n-1); } - - + return f; } int main() diff --git a/C/program-38/a.out b/C/program-38/a.out deleted file mode 100755 index 0bb435f1..00000000 Binary files a/C/program-38/a.out and /dev/null differ diff --git a/C/program-38/program.c b/C/program-38/program.c index 02f4e88d..1a771155 100644 --- a/C/program-38/program.c +++ b/C/program-38/program.c @@ -11,15 +11,13 @@ int f; if( n==1) { - - return ; + return 1; } else { f=n*fact(n-1); } - - + return f; } int main() diff --git a/C/program-39/a.out b/C/program-39/a.out deleted file mode 100755 index 4ebdcb8d..00000000 Binary files a/C/program-39/a.out and /dev/null differ diff --git a/C/program-39/program.c b/C/program-39/program.c index 1d0f60f9..8bbcd1a1 100644 --- a/C/program-39/program.c +++ b/C/program-39/program.c @@ -7,7 +7,6 @@ Program to find the GCD of a number using recursion int gcd(int a,int b) { -int f; if( b!=0) { @@ -16,7 +15,7 @@ int f; } else { - return; + return a; } diff --git a/C/program-40/program.c b/C/program-40/program.c index f48a3382..d0d11ff5 100644 --- a/C/program-40/program.c +++ b/C/program-40/program.c @@ -8,7 +8,8 @@ int ack(int m,int n) else if(m!=0 && n==0) return ack(m-1,1); else if (m!=0 && n!=0) - return ack(m-1,ack(m,n-1)); + return ack(m-1,ack(m,n-1)); + return 0; } int main() diff --git a/C/program-42/program42.c b/C/program-42/program.c similarity index 94% rename from C/program-42/program42.c rename to C/program-42/program.c index 5a6154b0..3dd7b554 100644 --- a/C/program-42/program42.c +++ b/C/program-42/program.c @@ -1,7 +1,7 @@ /*C Program to print Floyd’s triangle*/ // Without using a temporary variable and with only one loop #include -void floyd(n){ +void floyd(int n){ int i,j=1; for (i=1;i<=(n*(n+1))/2;i++){ printf("%d ",i); diff --git a/C/Program-43/program.c b/C/program-43/program.c similarity index 100% rename from C/Program-43/program.c rename to C/program-43/program.c diff --git a/C/program-44/program.c b/C/program-44/program.c index 24dbbcb7..4b686c63 100644 --- a/C/program-44/program.c +++ b/C/program-44/program.c @@ -5,7 +5,7 @@ // Alphabet Z Pattern void alphabet_Z_Pattern(int N) { - int index, side_index, size; + int index, side_index; // Declaring the values of Right, // Left and Diagonal values diff --git a/Java/program-1/README.md b/Java/program-1/README.md new file mode 100644 index 00000000..5bf7551a --- /dev/null +++ b/Java/program-1/README.md @@ -0,0 +1,9 @@ +Program 1 + +Write a program to find the maximum and minimum element in an array. + +Variable description-- +N=Number of elements in an array +arr=Array of size N +min= Holds the minimum element +max=Holds the maximum element \ No newline at end of file diff --git a/Java/program-1/program.java b/Java/program-1/program.java new file mode 100644 index 00000000..8abc89cd --- /dev/null +++ b/Java/program-1/program.java @@ -0,0 +1,24 @@ +import java.util.*; +import java.io.*; + +class prg { + public static void main (String[] args) { + Scanner sc=new Scanner(System.in); + System.out.println("Enter the size of array"); + int N=sc.nextInt(); + int arr[]=new int[N]; + System.out.println("Enter the elements in the array"); + for(int i=0;imax) + max=arr[i]; + } + System.out.println("Minimum="+min+"\nMaximum="+max); + } +} \ No newline at end of file