Skip to content
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
39 changes: 39 additions & 0 deletions Array-Sorting-Without-Function/JayAkbari/bubblesort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

#include <stdio.h>
#define MAXSIZE 10

void main()
{
int array[MAXSIZE];
int i, j, num, temp;
printf("Enter the value of num \n");
scanf("%d", &num);
printf("Enter the elements one by one \n");
for (i = 0; i < num; i++)
{
scanf("%d", &array[i]);
}
printf("Input array is \n");
for (i = 0; i < num; i++)
{
printf("%d\n", array[i]);
}
/* Bubble sorting begins */
for (i = 0; i < num; i++)
{
for (j = 0; j < (num - i - 1); j++)
{
if (array[j] > array[j + 1])
{
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
printf("Sorted array is...\n");
for (i = 0; i < num; i++)
{
printf("%d\n", array[i]);
}
}
34 changes: 34 additions & 0 deletions Nth-Digit-Fibonacci/JayAkabri/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.io.*;
import java.util.*;
public class Main {

public static void main(String[] args) {

int n = 1000, t1 = 0, t2 = 1,count=1,no=0;

Scanner sc = new Scanner(System.in);

System.out.println("Enter Number");
no = sc.nextInt();

// System.out.print("Upto " + n + ": ");
while (count<n)
{
// System.out.print(t1 + " + ");

int sum = t1 + t2;
t1 = t2;
t2 = sum;
count+=1;
String len=String.valueOf(sum);
if (len.length()==no)
{
System.out.println(count);

break;
}


}
}
}
31 changes: 31 additions & 0 deletions Palindrome/pelindrom.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<stdio.h>
int pelindrome(int n)
{
int t,r = 0;
t=n;
while(t!=0)
{
r=r*10;
r=r+(t%10);
t=t/10;
}
if(r==n)
return 1;
else
return 0;
}
void main()
{
int k,d,i;
printf("enter number: ");
scanf("%d",&k);
i = k + 1;
while(1)
{
d=palindrome(i);
if(d==1)
break;
i++;
}
printf("%d",i);
}