Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
glkink
/
C-programming
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
878cd712
authored
Jan 23, 2022
by
glkink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
b98bc339
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
ül1
ül1
0 → 100644
View file @
878cd712
//
//
// Created by Glen Kink on 09.11.2021.
//
#include <stdio.h>
#include <string.h>
int main(void)
{
int i,j,sonadeArv;
printf("Sisesta sonade arv\n");
scanf("%d", &sonadeArv);
char sonad[sonadeArv][20];
int massiiv[sonadeArv];
printf("Sisesta %d sona:", sonadeArv);
for(i = 0; i < sonadeArv; i++)
{
scanf("%s", sonad[i]);
}
for(i = 0; i < sonadeArv; i++)
{
int r = strlen(sonad[i]);
int min = 0;
int max = 0;
if(r < 2)
{
massiiv[i] = 0;
continue;;
}
for (j = 0; j < r-1; j++)
{
if (sonad[i][j] > sonad[i][j + 1])
{
min++;
}
if (sonad[i][j] < sonad[i][j + 1])
{
max++;
}
}
if(min == 0 && max != 0)
{
massiiv[i] = 2;
}
else if(max == 0 && min != 0)
{
massiiv[i] = 3;
}
else
{
massiiv[i] = 1;
}
}
for (i = 0; i < sonadeArv; i++)
{
printf("Sona %s ",sonad[i]);
switch (massiiv[i])
{
case 0:
printf("liiga luhike");
break;
case 1:
printf("pole sorditud");
break;
case 2:
printf("sorditud kahanevalt");
break;
case 3:
printf("sorditud kahanevalt");
break;
default:
printf(" ");
break;
}
printf("\n");
}
return 0;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment