Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Binary file added program-15/a.out
Binary file not shown.
13 changes: 13 additions & 0 deletions program-15/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include<stdio.h>
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;
}
2 changes: 2 additions & 0 deletions program-15/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Program-15
## This is a c program to find sum of number which are divisible by 3
45 changes: 45 additions & 0 deletions program-16/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Binary file added program-16/a.out
Binary file not shown.
17 changes: 17 additions & 0 deletions program-16/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<stdio.h>
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;
}
2 changes: 2 additions & 0 deletions program-16/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Program-16
## This is a c program to check given number is neon number
Binary file added program-17/a.out
Binary file not shown.
14 changes: 14 additions & 0 deletions program-17/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<stdio.h>
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;
}
Binary file added program-18/a.out
Binary file not shown.
29 changes: 29 additions & 0 deletions program-18/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include<stdio.h>
int power(int x,int y)
{ int i,t=x;
for(i=1;i<y;i++) x*=t;
return x;
}
int main()
{
int t,n,s,i,count=0,r,sum=0;
printf("enter the number\n");
scanf("%d",&n);
t=s=n;
while(s!=0)
{
s=n/10;
count++;

}
printf("%d\n",count);
while(n!=0)
{
r=n%10;
sum+=power(r,count);
n/=10;
}
if(sum==t) printf("Amstrong number = %d\n",sum);

return 0;
}
Binary file added program-19/a.out
Binary file not shown.
11 changes: 11 additions & 0 deletions program-19/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include<stdio.h>
int main()
{
int i,x,y,t;
printf("enter x and y\n");
scanf("%d%d",&x,&y);
t=x;
for(i=1;i<y;i++) x*=t;
printf("power =%d\n",x);
return 0;
}
Binary file added program-20/a.out
Binary file not shown.
8 changes: 8 additions & 0 deletions program-20/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include<stdio.h>
void main()
{
if(printf("hello world\n"))
{

}
}
Binary file added program-21/a.out
Binary file not shown.
17 changes: 17 additions & 0 deletions program-21/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<stdio.h>
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;
}