Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmehta03 authored Oct 25, 2024
1 parent 8c469a4 commit 87ae3a0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
35 changes: 35 additions & 0 deletions AYUSHMEHTA/bubblesor.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include<stdio.h>
void swap(int *a,int *b)
{
*a=*a+*b;
*b=*a-*b;
*a=*a-*b;
return;
}
int main()
{
int n;
printf("enter size ");
scanf("%d",&n);
int arr[n];
printf("enter array \n");
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-1-i;j++)
{
if(arr[j]>arr[j+1])
{
swap(&arr[j],&arr[j+1]);
}
}
}
printf("sorted array \n");
for(int i=0;i<n;i++)
{
printf("%d ",arr[i]);
}
}
16 changes: 16 additions & 0 deletions AYUSHMEHTA/sentencefirstword.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<stdio.h>
int main()
{
char s[100];
printf("enter a sentance ");
fgets(s,100,stdin);
printf("%c",s[0]);
for(int i=0;i<100;i++)
{
if(s[i]==' ')
{
printf("%c",s[i+1]);
}
}
return 0;
}

0 comments on commit 87ae3a0

Please sign in to comment.