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

mahunt / 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 e6ff23fd authored 6 years ago by mahunt's avatar mahunt
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

all

parent b82b5094 master
Hide whitespace changes
Inline Side-by-side
Showing with 90 additions and 0 deletions
  • Lab 1/Gregory.c
  • Lab 1/binConv.c
  • Lab 1/largeSmall.c
Lab 1/Gregory.c 0 → 100644
View file @ e6ff23fd
#include <stdio.h>
int main()
{
int inputDate = 30062018;
int v = 0;
int day = inputDate/1000000;
int month = inputDate%100000/10000;
int year = inputDate%10000;
if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
if(day < 31 && day > 0)
{
v = inputDate;
}
}
if(month == 4 || month == 6 || month == 9 || month == 11)
{
if(day < 30 && day > 0)
{
v = inputDate;
}
}
if(month == 2)
{
if(year%4 == 0 || year%100 != 0 || year%400 != 0)
{
if(day < 29 && day > 0)
{
v = inputDate;
}
}
else
{
if(day < 28 && day > 0)
{
v = inputDate;
}
}
}
}
This diff is collapsed. Click to expand it.
Lab 1/binConv.c 0 → 100644
View file @ e6ff23fd
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num = 1234;
int posit = 0;
int bina[32];
int i;
while(num > 0)
{
bina[posit] = num%2;
num /= 2;
posit++;
}
for(i = posit-1; i >= 0; i--)
{
printf("%d", bina[i]);
}
return 0;
}
This diff is collapsed. Click to expand it.
Lab 1/largeSmall.c 0 → 100644
View file @ e6ff23fd
#include <stdio.h>
int main()
{
int nums[] = {15, 6, 7, 98, -8, 65, 777, -87, 213, 5};
int largest = nums[0];
int smallest = nums[0];
int i;
for(i = 0; i < 10; i = i+1)
{
if(largest < nums[i]) largest = nums[i];
if(smallest > nums[i]) smallest = nums[i];
}
printf("%d", largest);
printf("\n %d", smallest);
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