Skip to content

Commit

Permalink
Merge pull request #61 from RaghavNotFound/main
Browse files Browse the repository at this point in the history
Questions
  • Loading branch information
Amit-S-Sahu authored Oct 26, 2024
2 parents 999e80a + 1d7b3f9 commit 528fea9
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Raghav/bub.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdio.h>
void main()
{
printf("Enter the value of n");
int n;
scanf("%d",&n);
int a[n];
for (int i=0;i<n-1;i++)
{
for (int j=0;j<n-i-1;j++)
{
if (a[j]>a[j+1])
{
int temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
printf("Sorted aay: \n");
for (int i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
}
34 changes: 34 additions & 0 deletions Raghav/dert.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include<stdio.h>
void main()
{
int a[3][3],b[2][2],d[3],f,y=0,z;
printf("Enter elements\n");
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
scanf("%d",& a[i][j]);
}
}
for(int k=0;k<3;k++)
{
y=0;
for(int i=0;i<3;i++)
{
z=0;
for(int j=0;j<3;j++)
{
if (j!=k||i!=0)
{
b[y][z]=a[i][j];
z++;
}
}
if (i!=0)
y++;
}
d[k]=a[0][k]*((b[0][0]*b[1][1])-(b[1][0]*b[0][1]));
}
f=d[0]-d[1]+d[2];
printf("Determinant %d\n",f);
}
15 changes: 15 additions & 0 deletions Raghav/fact.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<stdio.h>
int FACT(int n)
{
if(n==0)
return 1;
else
return n*FACT(n-1);
}
void main()
{
int n;
printf("Enter the value of n\n");
scanf("%d", &n);
printf("The Factorial is %d",FACT(n));
}
17 changes: 17 additions & 0 deletions Raghav/ini.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <string.h>
void main()
{
char str[100];
printf("Enter a string: ");
gets (str);
printf("Initials: ");
for(int i=0;i<strlen(str);i++)
{
if(i==0||str[i-1]==' ')
{
printf("%c ", str[i]);
}
}
printf("\n");
}
17 changes: 17 additions & 0 deletions Raghav/plin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <string.h>
int main()
{
char str[50];
printf("Enter a string: ");
gets(str);
int len = strlen(str);
int i,t=0;
for (i = 0; i < len / 2; i++)
if (tolower(str[i]) != tolower(str[len - i - 1]))
t=1;
if (t==0)
printf("%s is a palindrome.\n", str);
else
printf("%s is not a palindrome.\n", str);
}

0 comments on commit 528fea9

Please sign in to comment.