diff --git a/LICENSE b/.vscode/LICENSE similarity index 100% rename from LICENSE rename to .vscode/LICENSE diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..f1cba91 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/workspaces/HTML", + "program": "/workspaces/HTML/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b523d59 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,62 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false, + "files.associations": { + "NEW.C": "cpp" + } +} \ No newline at end of file diff --git a/CHARACTER HANDLING/Area_Of_All.c b/CHARACTER HANDLING/Area_Of_All.c new file mode 100644 index 0000000..4e064f0 --- /dev/null +++ b/CHARACTER HANDLING/Area_Of_All.c @@ -0,0 +1,74 @@ +#include' +int main(){ + int area,choice=0; + do{ + printf("*********SELECT THE SHAPE*********\n"); + printf("\nOption-1:Rectangle"); + printf("\nOption-2:Circle"); + printf("\nOption-3:Square"); + printf("\nOption-4:Triangle"); + printf("\nOption-5:Exit"); + printf("\nEnter your choice: "); + printf("\ndo you want to continue.. press(0 to exit/5 to continue)? "); + scanf("%d",&choice); + switch(choice){ + case 1: { + int length,breadth; + printf("Enter the length and breadth of rectangle: "); + scanf("%d%d",&length,&breadth); + #include + + int main() { + int choice = 0; + do { + printf("\n********* SELECT THE SHAPE *********\n"); + printf("Option-1: Rectangle\n"); + printf("Option-2: Circle\n"); + printf("Option-3: Square\n"); + printf("Option-4: Triangle\n"); + printf("Option-5: Exit\n"); + printf("Enter your choice: "); + scanf("%d", &choice); + + switch (choice) { + case 1: { + int length, breadth, area; + printf("Enter the length and breadth of rectangle: "); + scanf("%d%d", &length, &breadth); + area = length * breadth; + printf("Area of rectangle is: %d\n", area); + break; + } + case 2: { + float radius, area; + printf("Enter the radius of circle: "); + scanf("%f", &radius); + area = 3.14f * radius * radius; + printf("Area of circle is: %.2f\n", area); + break; + } + case 3: { + int side, area; + printf("Enter the side of square: "); + scanf("%d", &side); + area = side * side; + printf("Area of square is: %d\n", area); + break; + } + case 4: { + float base, height, area; + printf("Enter the base and height of triangle: "); + scanf("%f%f", &base, &height); + area = 0.5f * base * height; + printf("Area of triangle is: %.2f\n", area); + break; + } + case 5: + printf("Exiting the program.\n"); + break; + default: + printf("Invalid choice! Please select a valid option.\n"); + } + } while (choice != 5); + return 0; + } \ No newline at end of file diff --git a/CHARACTER HANDLING/Char_Digit_Choice.c b/CHARACTER HANDLING/Char_Digit_Choice.c new file mode 100644 index 0000000..21db5cf --- /dev/null +++ b/CHARACTER HANDLING/Char_Digit_Choice.c @@ -0,0 +1,25 @@ +# include +#include +int main(){ + char ch, choice; + do { + printf("Enter a character: "); + scanf("\n%c", &ch); + if (isanum(ch)) { + if (isdigit(ch)) { + printf("the character is a digit\n"); + } else if (isalpha(ch)) { + if (islower(ch)) { + printf("the character entered is an alphabet(lowercase)\n"); + } else if (isupper(ch)) { + printf("the character entered is an alphabet(uppercase)\n"); + } + } + } else { + printf("the character entered is a special character\n"); + } + printf("\nDo you want to continue? (y/n): "); + scanf(" %c", &choice); + } while (choice == 'y' || choice == 'Y'); + return 0; +} \ No newline at end of file diff --git a/CHARACTER HANDLING/New.c b/CHARACTER HANDLING/New.c new file mode 100644 index 0000000..2061424 --- /dev/null +++ b/CHARACTER HANDLING/New.c @@ -0,0 +1,16 @@ +# include +# include +#include +int main (){ + char choice; + do + { + printf("do you wish to comtinue (y/n)? "); + scanf("\n%c",&choice); + + } + + while(choice=='y'||choice=='Y'); + printf("\n existing programme......"); + return 0; +} \ No newline at end of file diff --git a/CHARACTER HANDLING/output/Area_Of_All b/CHARACTER HANDLING/output/Area_Of_All new file mode 100755 index 0000000..202c1ec Binary files /dev/null and b/CHARACTER HANDLING/output/Area_Of_All differ diff --git a/CHARACTER HANDLING/output/Char_Digit b/CHARACTER HANDLING/output/Char_Digit new file mode 100755 index 0000000..f1b7ee2 Binary files /dev/null and b/CHARACTER HANDLING/output/Char_Digit differ diff --git a/CHARACTER HANDLING/output/New b/CHARACTER HANDLING/output/New new file mode 100755 index 0000000..2809d93 Binary files /dev/null and b/CHARACTER HANDLING/output/New differ diff --git a/PROGRAMS/Do_While_Age.c b/PROGRAMS/Do_While_Age.c new file mode 100644 index 0000000..79998c5 --- /dev/null +++ b/PROGRAMS/Do_While_Age.c @@ -0,0 +1,23 @@ +# include +int main(){ + int age,count=0; + do{ + printf("Enter your age:"); + scanf("%d",&age); + if(age<0){ + printf("age cannot be negative.\n"); + count++; + }else if(age==0){ + printf("age cannot be zero.\n"); + count++; + }else if(age>100){ + printf("age cannot be greater than 100.\n"); + count++; + } + }while(age<=0||age>100); + if(age>0 && age<=100){ + printf("Your age is %d\n",age); + printf("you entered wrong input %d times",count); + } + return 0; +} \ No newline at end of file diff --git a/PROGRAMS/Even_Odd.c b/PROGRAMS/Even_Odd.c new file mode 100644 index 0000000..a8d3f22 --- /dev/null +++ b/PROGRAMS/Even_Odd.c @@ -0,0 +1,17 @@ +#include +int main() +{ + int inumber; + printf("enter the number"); + scanf("%d",&inumber); + printf("%d is %s\n",inumber,(inumber%2==0)?"even":"odd"); + if( inumber%2==0) + { + printf("the number is even\n",inumber); + } + else + { + printf("the number is odd\n",inumber); + } + return 0; +} \ No newline at end of file diff --git a/PROGRAMS/Is_Prime_Not_Prime.c b/PROGRAMS/Is_Prime_Not_Prime.c new file mode 100644 index 0000000..358d5e0 --- /dev/null +++ b/PROGRAMS/Is_Prime_Not_Prime.c @@ -0,0 +1,23 @@ +#include +int main (){ + int i,num,count=0; + printf("Enter a Number"); + scanf("%d",&num); + for(i=1;i<=num;i++) +{ + if(num%i==0) + { + count++; + + } +} +if(count==2) +{ + printf("the number is prime"); + +} +else{ + printf("the number is not prime"); +} + return 0; +} \ No newline at end of file diff --git a/PROGRAMS/Large_Of_3_Numbers.c b/PROGRAMS/Large_Of_3_Numbers.c new file mode 100644 index 0000000..ed3ea60 --- /dev/null +++ b/PROGRAMS/Large_Of_3_Numbers.c @@ -0,0 +1,25 @@ +#include +int main() + +{ + int a,b,c; + printf("Enter the value of a,b and c:"); + scanf("%d %d %d",&a,&b,&c); + if(a>b){ + if(a>c){ + printf("a=%d is the largest",a); + } + else{ + printf("c=%d is the largest",c); + } + } + else{ + if(b>c){ + printf("b=%d is the largest",b); + } + else{ + printf("c=%d is the largest",c); + } + } + return 0; +} \ No newline at end of file diff --git a/PROGRAMS/Strom_Loop.c b/PROGRAMS/Strom_Loop.c new file mode 100644 index 0000000..0f26aaf --- /dev/null +++ b/PROGRAMS/Strom_Loop.c @@ -0,0 +1,24 @@ +#include +int main() { + int num, original, digit, fact, sum_digits, i; + printf("Enter a number: "); + scanf("%d", &num); + + original = num; + sum_digits = 0; + while (num > 0) { + digit = num % 10; + fact = 1; + for (i = 2; i <= digit; i++) { + fact *= i; + } + sum_digits = sum_digits + fact; + printf("\ndigit=%d sum fact=%d", digit, sum_digits); + num = num / 10; + } + + original == sum_digits ? printf("\nSTRONG no") : printf("\nNot STRONG no"); + printf("\n I am out of the loop because num=%d...", num); + + return 0; +} \ No newline at end of file diff --git a/PROGRAMS/output/Do_While_Age b/PROGRAMS/output/Do_While_Age new file mode 100755 index 0000000..e8741ba Binary files /dev/null and b/PROGRAMS/output/Do_While_Age differ