Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Swapnita06 authored Apr 6, 2023
0 parents commit 967f0ed
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 0 deletions.
19 changes: 19 additions & 0 deletions EIGHTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>
#include<string.h>
int main(){
int i,v=0,c=0;
char str[100];
printf("Enter the string:");
gets(str);
for(i = 0; i < strlen(str); i++){
if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') {
v++;
}
else if(str[i] >= 'a' && str[i] <= 'z'){
c++;
}
}
printf("Number of vowels : %d\n", v);
printf("Number of consonant : %d", c);
return 0;
}
20 changes: 20 additions & 0 deletions FIFTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>
int main(){
int arr[]={1,7,5,3,1};
int MaxCount=0;
int MaxFreq;
for(int i=0;i<5;i++){
int count=0;
for(int j=0;j<5;j++){
int k=arr[i];
if(arr[j]==k){
count++;
}
}
if (count >MaxCount){
MaxCount=count;
MaxFreq = arr[i];
}
}
printf("The most frequent no is : %d and it has occured %d times",MaxFreq, MaxCount);
}
29 changes: 29 additions & 0 deletions FIRST.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>

int main(){
int n, i, num, occr = 0;

printf("Enter the Array size = ");
scanf("%d", &n);

int arr[n];

printf("Enter the %d elements : ", n);
for (i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
}

printf("Enter the Item to Know = ");
scanf("%d", &num);

for (i = 0; i < n; i++)
{
if (arr[i] == num)
{
occr++;
}
}

printf("%d Occurred %d Times.\n", num, occr);
}
14 changes: 14 additions & 0 deletions FOURTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>

int main(){
int i,j,num=1;
for(i=0;i<5;i++){
for (j=0;j<=i;j++){
printf("%d ", num);
num++;
}
printf("\n");
}
return 0;
}

13 changes: 13 additions & 0 deletions NINTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdio.h>
int main() {
int i, j, rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = rows; i >= 1; --i) {
for (j = 1; j <= i; ++j) {
printf("* ");
}
printf("\n");
}
return 0;
}
59 changes: 59 additions & 0 deletions SECOND.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include <stdio.h>

int main(){
int n, m, i= 0;

printf("Enter the Array1 size = ");
scanf("%d", &n);

int arr1[n];

printf("Enter the %d elements : ", n);
for (i = 0; i < n; i++)
{
scanf("%d", &arr1[i]);
}

printf("Enter the Array2 size = ");
scanf("%d", &m);

int arr2[m];

printf("Enter the %d elements : ", m);
for (i = 0; i < m; i++)
{
scanf("%d", &arr2[i]);
}

int totsize = n+m;

int Mgdarr[totsize];

for(i=0; i<n; i++){
Mgdarr[i]=arr1[i];
}

for(i=0; i< totsize; i++){
Mgdarr[n+i]=arr2[i];
}

for(i=0; i< totsize; i++){
printf("%d", Mgdarr[i]);
}

printf("\n");

for(int i=0; i<totsize/2; i++){
int firstvl=Mgdarr[i];
int secval=Mgdarr[totsize-i-1];
Mgdarr[i]=secval;
Mgdarr[totsize-i-1]=firstvl;}

for(i=0; i< totsize; i++){
printf("%d", Mgdarr[i]);
}

return 0;
}


19 changes: 19 additions & 0 deletions SEVENTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<stdio.h>

int main(){
int arr[]={1,2,-9,-6,4,2};
int j=0;
for(int i=0;i<6;i++){
if(arr[i]<0){
if(i!=j){
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
j++;
}
}
for(int i=0;i<6;i++){
printf("%d ", arr[i]);
}
}
20 changes: 20 additions & 0 deletions SIXTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>
int main(){
int arr[]={1,7,5,3,1};
int MaxCount=0;
int MaxFreq;
for(int i=0;i<5;i++){
int count=0;
for(int j=0;j<5;j++){
int k=arr[i];
if(arr[j]==k){
count++;
}
}
if (count >MaxCount){
MaxCount=count;
MaxFreq = arr[i];
}
}
printf("The most frequent no is : %d and it has occured %d times",MaxFreq, MaxCount);
}
29 changes: 29 additions & 0 deletions TENTH.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <string.h>

int main()
{
char s[100];
int i,k,alpha=0,digit=0,spchar=0;

printf("Enter the string : ");
gets(s);

k=strlen(s);

for(i=0;i<k;i++) {
if((s[i]>=65 && s[i]<=90)|| (s[i]>=97 && s[i]<=122) )
alpha++;
else if(s[i]>=48 && s[i]<=57)
digit++;
else
spchar++;

}


printf("Alphabets = %d\n",alpha);
printf("Digits = %d\n",digit);
printf("Special characters = %d", spchar);
return 0;
}
40 changes: 40 additions & 0 deletions THIRD.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <stdio.h>
#include <conio.h>

int sort(int *a,int n);
int print(int *a,int n);


int main(){
int a[100],i,n;

printf("Enter size of the array : ");
scanf("%d", &n);
printf("Enter elements in array : ");
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}

sort(a,n);
print(a,n);

return 0;
}

int sort(int *a,int n){
int i,j,temp;
for(i=0; i<n-1; i++){
for(j=0; j<n-i-1; j++){
if(a[j]>a[j+1]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;}
}
}
}
int print(int *a,int n){
int i;
for(i=0; i<n; i++){
printf("%d ",a[i]);}
}

0 comments on commit 967f0ed

Please sign in to comment.