diff --git a/program-14/program.c.c b/program-14/program.c similarity index 100% rename from program-14/program.c.c rename to program-14/program.c diff --git a/program-15/a.out b/program-15/a.out new file mode 100755 index 00000000..e9bd45dd Binary files /dev/null and b/program-15/a.out differ diff --git a/program-15/program.c b/program-15/program.c new file mode 100644 index 00000000..a263403b --- /dev/null +++ b/program-15/program.c @@ -0,0 +1,13 @@ +#include +int main() +{ + int a,b,r=0,i; + printf("enter the range\n"); + scanf("%d%d",&a,&b); + for(i=a;i<=b;i++) + { + if(i%3==0) r=r+i; + } +printf("sum=%d\n",r); +return 0; +} \ No newline at end of file diff --git a/program-15/readme.md b/program-15/readme.md new file mode 100644 index 00000000..59501430 --- /dev/null +++ b/program-15/readme.md @@ -0,0 +1,2 @@ +# Program-15 +## This is a c program to find sum of number which are divisible by 3 \ No newline at end of file diff --git a/program-16/.vscode/launch.json b/program-16/.vscode/launch.json new file mode 100644 index 00000000..c3a20dda --- /dev/null +++ b/program-16/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // 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/program-16/a.out b/program-16/a.out new file mode 100755 index 00000000..d58aae3f Binary files /dev/null and b/program-16/a.out differ diff --git a/program-16/program.c b/program-16/program.c new file mode 100644 index 00000000..c773ea28 --- /dev/null +++ b/program-16/program.c @@ -0,0 +1,17 @@ +#include +int main() +{ + int n,s,sum=0,r; + printf("enter the number\n"); + scanf("%d",&n); + s=n*n; + while(s!=0) + { + r=s%10; + sum+=r; + s/=10; + } + if(n==sum) printf("Neon number\n"); + else printf("not neon number"); + return 0; +} \ No newline at end of file diff --git a/program-16/readme.md b/program-16/readme.md new file mode 100644 index 00000000..12b396a0 --- /dev/null +++ b/program-16/readme.md @@ -0,0 +1,2 @@ +# Program-16 +## This is a c program to check given number is neon number \ No newline at end of file diff --git a/program-17/a.out b/program-17/a.out new file mode 100755 index 00000000..7d2df0d4 Binary files /dev/null and b/program-17/a.out differ diff --git a/program-17/program.c b/program-17/program.c new file mode 100644 index 00000000..0d630efd --- /dev/null +++ b/program-17/program.c @@ -0,0 +1,14 @@ +#include +int main() +{ + int n,s,i; + printf("enter the number\n"); + scanf("%d",&n); + for(i=1;i<(n/2)+1;i++) + { + if(n%i==0) s+=i; + } + if(n==s) printf("perfect number\n"); + else printf("non-perfect number\n"); + return 0; +} \ No newline at end of file diff --git a/program-18/a.out b/program-18/a.out new file mode 100755 index 00000000..0c9fa121 Binary files /dev/null and b/program-18/a.out differ diff --git a/program-18/program.c b/program-18/program.c new file mode 100644 index 00000000..45e5f37b --- /dev/null +++ b/program-18/program.c @@ -0,0 +1,29 @@ +#include +int power(int x,int y) +{ int i,t=x; + for(i=1;i +int main() +{ + int i,x,y,t; +printf("enter x and y\n"); +scanf("%d%d",&x,&y); +t=x; + for(i=1;i +void main() +{ +if(printf("hello world\n")) +{ + +} +} diff --git a/program-21/a.out b/program-21/a.out new file mode 100755 index 00000000..241d921c Binary files /dev/null and b/program-21/a.out differ diff --git a/program-21/program.c b/program-21/program.c new file mode 100644 index 00000000..0cfb05d1 --- /dev/null +++ b/program-21/program.c @@ -0,0 +1,17 @@ +#include +int main() +{ + int a,i,count=0; + printf("enter the number\n"); + scanf("%d",&a); + for(i=2;i<=a/2;i++) + { + if(a%i==0) + { + count=1; + break; + }} +if(count) printf("not prime"); +else printf("prime"); +return 0; +} \ No newline at end of file