Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

otsall / iax0583

  • This project
    • Loading...
  • Sign in
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 43a9db12 authored 6 years ago by otsall's avatar otsall
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

lab 3 works

parent 5b9d3e19
Hide whitespace changes
Inline Side-by-side
Showing with 122 additions and 0 deletions
  • Lab3/pracwork1
  • Lab3/pracwork1.c
  • Lab3/pracwork1.o
  • Lab3/pracwork2
  • Lab3/pracwork2.c
  • Lab3/userinput
  • Lab3/userinput.c
Lab3/pracwork1 0 → 100644
View file @ 43a9db12
File added
This diff is collapsed. Click to expand it.
Lab3/pracwork1.c 0 → 100644
View file @ 43a9db12
#include <stdio.h>
int main ()
{
int array[10];
int i;
for(i=0; i<10; i++)
{
array[i] = i+1;
}
i=0;
while(i<10)
{
if(i%2)
{
printf("%d\n", array[i]);
}
i++;
}
i=0;
while(i<10)
{
if(i%2)
{
printf("%d\n", array[i-1]);
}
i++;
}
i=9;
while(i>=0)
{
printf("%d\n", array [i]);
i--;
}
return 0;
}
This diff is collapsed. Click to expand it.
Lab3/pracwork1.o 0 → 100644
View file @ 43a9db12
File added
This diff is collapsed. Click to expand it.
Lab3/pracwork2 0 → 100644
View file @ 43a9db12
File added
This diff is collapsed. Click to expand it.
Lab3/pracwork2.c 0 → 100644
View file @ 43a9db12
#include <stdio.h>
int main(){
int i=2;
int a;
printf("define size of fibonacci array\n");
scanf ("%d", &a);
int array[a];
array[0]=0;
array[1]=1;
printf ("printing fibonacci\n");
printf ("1\n");
while(i <= a)
{
array[i]=array[i-1]+array[i-2];
printf("%d\n", array[i]);
i++;
}
i=1;
printf ("printing even numbers\n");
while(i<=a)
{
if(array[i]%2)
{
i++;
}else{
printf("%d\n", array [i]);
i++;
}
}
i=1;
printf ("printing odd numbers\n");
while(i<=a)
{
if(array[i]%2)
{
printf("%d\n", array[i]);
}
i++;
}
i=a;
printf("printing the sequence out backwards\n");
while (i>0)
{
printf("%d\n", array[i]);
i--;
}
return 0;
}
This diff is collapsed. Click to expand it.
Lab3/userinput 0 → 100644
View file @ 43a9db12
File added
This diff is collapsed. Click to expand it.
Lab3/userinput.c 0 → 100644
View file @ 43a9db12
#include <stdio.h>
int main(){
int x;
char c;
float y;
printf("insert integer");
scanf("%d", &x);
printf("insert character");
scanf("%c", &c);
printf("insert float");
scanf("%f", &y);
printf("%d, %c, %f", x, c, y);
return 0;
}
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment