From 139808b365f968638ca4845a7a8ebd26f66a2000 Mon Sep 17 00:00:00 2001 From: TANYOOMWARICHARD <38227200+TANYOOMWARICHARD@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:55:23 +0300 Subject: [PATCH] Add files via upload --- do_it.h | 6 ++++++ doit.h | 1 + done.h | 1 + main.c | 54 ++++++++++++++++++++++++++++++++++-------------- print_a_number.h | 6 ++++++ question two.cbp | 44 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 do_it.h create mode 100644 doit.h create mode 100644 done.h create mode 100644 print_a_number.h create mode 100644 question two.cbp diff --git a/do_it.h b/do_it.h new file mode 100644 index 00000000..d462baf8 --- /dev/null +++ b/do_it.h @@ -0,0 +1,6 @@ +#ifndef DO_IT_H +#define DO_IT_H + +float DO_IT_H(char x,char y,char z); + +#endif // DO_IT_H diff --git a/doit.h b/doit.h new file mode 100644 index 00000000..d3f5a12f --- /dev/null +++ b/doit.h @@ -0,0 +1 @@ + diff --git a/done.h b/done.h new file mode 100644 index 00000000..59372d07 --- /dev/null +++ b/done.h @@ -0,0 +1 @@ +#define AGE 20 diff --git a/main.c b/main.c index d923aa60..c2b8cb75 100644 --- a/main.c +++ b/main.c @@ -1,15 +1,39 @@ -#include -#include - -main(){ - char some_string[] = {}; - for (int i = 0; i < 20; ++i) { - scanf("%s", some_string); - if (some_string[i] == EOF) - { - break; - } - } - putchar(some_string); - -} \ No newline at end of file +#include +#include + +int main() +{ + long int digits[50]; + + digits[49] = 123.456; + + printf("Values of X\n"); + int x; + for (x=0; x<100; x++){ + printf(" %d\t",x); + } /*final value of x is 99*/ + + printf("\n\nValues of ctr\n"); + int ctr; + for (ctr=2; ctr<10; ctr+=3){ + printf(" %d\t",ctr); + } /*final value of ctr is 8*/ + + printf("\n\nCounting from 1 to 100\n"); + int count=1; + while(count<=100){ + printf(" %d\t",count); + count +=3 ; + } + + /* for (counter = 1; counter < MAXVALUES; counter ++); + printf("\n Counter = %d", counter); */ + + /* Problems in the above code are; MAXVALUES not declared to a specific data type, + counter not declared an integer, curly braces not used after the 'for' condition, + and the 'for loop' was wrongly terminated before printf statement.*/ + + + return 0; +} + diff --git a/print_a_number.h b/print_a_number.h new file mode 100644 index 00000000..3baa377b --- /dev/null +++ b/print_a_number.h @@ -0,0 +1,6 @@ +#ifndef PRINT_A_NUMBER_H +#define PRINT_A_NUMBER_H + +float PRINT_A_NUMBER_H(int a); + +#endif // PRINT_A_NUMBER_H diff --git a/question two.cbp b/question two.cbp new file mode 100644 index 00000000..8dba2b18 --- /dev/null +++ b/question two.cbp @@ -0,0 +1,44 @@ + + + + + +