Commit e6ff23fd by mahunt

all

parent b82b5094
#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;
}
}
}
}
#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;
}
#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;
}
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