Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c program #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions arr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# include<stdio.h>
void main()
{
int i,n,a[100],temp;
printf("enter the number of elements\n");
scanf("%d",&n);
printf("enter elements\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
temp=a[0];
for(i=0;i<n-1;i++)
{
a[i]=a[i+1];
}
a[n-1]=temp;
printf("shift one position left");
for(i=0;i<n;i++)
{
printf("%d",a[i]);
}
}


21 changes: 21 additions & 0 deletions swapfunction.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# include<stdio.h>
int swap(int a, int b)
{
a=a+b;
b=a-b;
a=a-b;
printf("After swapping first value is=%d\nAfter swapping second value=%d\n",a,b);

return a,b;

}
int main()
{
int c,d;
printf("Enter Two numbers\n");
scanf("%d\n%d",&c,&d);
swap(c,d);


return 0;
}