Skip to content

Commit

Permalink
Merge pull request vglug#32 from dilip0207/main
Browse files Browse the repository at this point in the history
reverse_all_the_words_in_a_sentence
  • Loading branch information
manimaran96 authored Oct 31, 2021
2 parents 6da21ef + 32fa08f commit ee998ad
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 0 deletions.
36 changes: 36 additions & 0 deletions c/Divide_by_sum_of_maximum_digits_in_array
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include<stdio.h>
void main()
{
int max,i,n,temp,rem,sum=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
i=1;
while(i<n)
{
if(max<a[i])
max=a[i];

i++;
}
float preci;
temp=max;
while(temp)
{
rem=temp%10;
sum=sum+rem;
temp=temp/10;
}
i=0;
while(i<n)
{
preci=(float)a[i]/sum;
printf("%.2f ",preci);
i++;
}

}
20 changes: 20 additions & 0 deletions c/Fibonacci_series_in_reverse_order
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>
void main()
{
int j,i,n,a=-1,b=1,c=0;
int d[20];
scanf("%d",&n);
i=0;
while(i<n)
{
c=a+b;
d[i]=c;
a=b;
b=c;
i++;
}
for(j=i-1;j>=0;j--)
{
printf("%d ",d[j]);
}
}
45 changes: 45 additions & 0 deletions c/common_first_character_words_in_string
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include<stdio.h>
#include<string.h>
int findlength(char s[])
{
int i,count=0;
for(i=0;s[i]!='\0';i++)
{
count++;
}
return count;
}
void main()
{
int i,n,j;
char s[30];
gets(s);
n=findlength(s);
for(i=0;i<n;i++)
{
if(s[i]!=' ')
{
printf("%c",s[i]);
}
else
break;
}
printf(" ");
i++;
for(;i<n;i++)
{
if(s[0]==s[i] && s[i-1]==' ')
{
for(j=i;j<n;j++)
{
if(s[j]!=' ')
{
printf("%c",s[j]);
}
else
break;
}
printf(" ");
}
}
}
31 changes: 31 additions & 0 deletions c/reverse_all_the_words_in_a_sentence
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<stdio.h>
#include<string.h>
void main()
{
int i,n,j,k;
char s[30];
gets(s);
n=strlen(s);
int a[20];
a[0]=-1;
j=1;
for(i=0;i<n;i++)
{
if(s[i]==' ')
{
a[j]=i;
j++;
}
}
a[j]=n;
j++;
for(k=0;k<j;k++)
{
for(i=a[k+1]-1;i>a[k];i--)
{
printf("%c",s[i]);
}
printf(" ");
}

}
31 changes: 31 additions & 0 deletions c/reverse_and_add_untill_a_palindrome_number_will_get
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<stdio.h>
int isrev(int n)
{
int temp,rev=0,rem;
temp=n;
while(temp)
{
rem=temp%10;
rev=rev*10+rem;
temp=temp/10;
}
return rev;
}
void main()
{
int n,i,sum1,count=0;
printf("enter the number");
scanf("%d",&n);
for(;;)
{
sum1=isrev(n)+n;
if(sum1==isrev(sum1))
{
printf(" %d is the palindrome number ",sum1);
break;
}
n=sum1;
count++;
}
printf("\n %d times iterated till palindrome obtain",count);
}
35 changes: 35 additions & 0 deletions c/strings_except_the_given_length_using_structure
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include<stdio.h>
#include<string.h>
struct except
{
char a[30];
};
int findlength(char s[])
{
int i,count=0;
for(i=0;s[i]!='\0';i++)
{
count++;
}
return count;
}
void main()
{
int i,n,x,flag=0;
scanf("%d%d",&n,&x);
struct except b[n];
for(i=0;i<n;i++)
{
scanf("%s",b[i].a);
}
for(i=0;i<n;i++)
{
if(x!=(findlength(b[i].a)))
{
printf("%s \n",b[i].a);
flag=1;
}
}
if(flag==0)
printf("-1");
}
38 changes: 38 additions & 0 deletions c/vowels_palindrome_in_a_string
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include<stdio.h>
#include<string.h>
int findlength(char s[])
{
int i,count=0;
for(i=0;s[i]!='\0';i++)
{
count++;
}
return count;
}
void main()
{
int i,n,j;
char s[30];
gets(s);
n=findlength(s);
char vowel[10];
j=0;
for(i=0;i<n;i++)
{
if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')
{
vowel[j]=s[i];
j++;
}
}
vowel[j]='\0';
for(i=0;i<j/2;i++)
{
if(vowel[i]!=vowel[j-1-i])
break;
}
if(i==j/2)
{
printf("yes");
}
}

0 comments on commit ee998ad

Please sign in to comment.