@MD_ItteshamItte/

C programming tutorial for beginners

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
//Hello everyone today your here to learn about C programming This is how you write a cooment in C//   // sa...// or /* adfa ....*/ is used for comments remember to always use the same type of comment processors for ending//
//This is how you write a C program//
/*#include <stdio.h> //1)you must write this 
#include<stdlib.h>//This header file is completely unnecessary but you can still use it//
int main(void) //2)you must write this
{//Dont forget the opening curly bracket
 printf("Hello World\n");//3)you must write this
return(0);//4) you must write this
} //and the closing bracket//
//Lets run the program//*/

/*#include <stdio.h>

int main(void) 
{
  int characterage =35; //this int is called a declaration of type integer the characterage you see is the name of the variable that will be of type integer//
  char charactername[] = "john"; //this char is called declaration of type character with a variable named charactername//
  printf("There's a man named %s\n",charactername);//the printf statement as you remember contains the strings or the stuff that the compiler displays on the screen so when you want to display character you can either type john after the "man named" or as i have done "%s " since i already declared the character variable john as char. This "%s" is called the string format specifier//
  printf("his age is %d\n",characterage); //"%d" is the  integer specifier format specifier stores the value specified in the assignment of character age
  printf("He liked his name %s\n",charactername); //similarly the %s is the string specifier format and prints the character 'john'on to the place of %s.
  printf("He hated his age %d\n",characterage);
  return 0;
}*/
//I am going to show an interesting property now using char declraration but using arrays//
//Whatever you write in the double quotation marks on your printf statement will end up being  displayed on your screen

/*If you repeat this with 3 as the no. of component in the array allocation for character name thgre is a hash appear5ing instead of John in the name printing*/

/*#include <stdio.h>

int main(void) 
{
  int characterage =35; //declarations Lets try using 35.5 //
  //Do you see the underline in the declarations? lets run it gave me errors//
  //Now I used the double ariable declaration which is used for declaring decimals and adjusted all the fomat specifiers accordingly by using %lf//
  char charactername[7] = "john"; //statement written using arrays Do you see the hash in the position of j//
  //You can either place [] or write any integer within the bracket stating its range as long as its greater than 4 since the no. of characters in john is 4//
  printf("There's a man named %s\n",charactername);//same printf statements executing//
  printf("his age is %d\n",characterage);
  printf("He liked his name %s\n",charactername);
  printf("He hated his age %d\n",characterage);
  return 0;
}//Code worked/
/*/
//Welcome to the 3rd video today we are continuing on previous lectures//
/*#include <stdio.h>

#include <stdlib.h>
int main(void) 
{
int age = 40;//age declared as int while assigned a value//
double gpa = 3.6;//decimal number assigned to gpa of type double assigned while declared.//
//for this decimal i can also use float to declare this variable//
float gpa_2 = 3.9;
char grade = 'A';//character A declared while assigned //
char phrase[] = "Faiaz Tutoring INC";//string declaration - IMPORTANT//
//lets run the program//
//if you learned before that declarations must be done before assigning  now you know they can be done at the same time//

//Have you noticed when I ran this program nothing printed in the compiler thats because printf statements allow us to communicate with compiler and user so no response//
printf("%d\n", age);//
printf("%c\n", grade);//If i wrote%s it would give me error as character format is different from string format//
printf("%s\n", phrase);//executes the string//
//Everything is printed in one line lets make newlines for all information//
//The \n makes everything godown to the next line//

return(0);
}*/
//thanks for watching till next time//
/*
//Hello Everone welcome to the next video of C programming made simple. Up till now I've only shown you how to write the code but never actually explained the logic hehind it. I won't teach this in that great depth today all in this video but I will go over many major things. 

//All these videos are dedicated to my mom who raised me and worked hard to feed me and send me to university. She's no longer with me. May God rest her soul in peace for eternity in heaven 
//As a human as a son I would request you all to listen to your mom. She's the only one on the planet who will give her life to save yours. May God bless our mothers in this world with beautiful things and grant them heaven in the after life. 

Header File:

Header files contain the set of predefined standard library functions that we can include in our c programs. But to use these various library functions, we have to include the appropriate header files. A header file has a .h extension that contains C function declarations and macro definition. There are two kinds of header files: the files that the developer writes and the files that come with your compiler. When we including a header file in a program, that means we copy the content of the header file.

C Header Files ---- Function
<stdio.h> ----- Standard input output function
<stdarg.h> ---- ccessing a varying number of arguments passed to functions
<stdlib.h> ---- Standard utility function
<string.h> ---- Standard string functions
<math.h> ------ Math Function
<ctype.h> ----- Character Handling Functions
<locale.h> ---- Localization Function
<assert.h> ---- Program assertion Functions
<setjmp.h> ----  Nonlocal Jump Functions
<stdarg.h> ----- Variable argument handling function
<time.h>   ----- Date time handling function
<signal.h> ----- Signal handling function
<cocale.h> ----- Localization Functions
<complex.h> ---- A set of function for manipulating complex numbers
<stdallign.h> --  querying and specifying the alignment of objects function
<uchar.h> ------ Defines wide string handling functions
<wchar.h> ------ Defines wide string handling functions
<stdbool.h> ---- Defining boolean data type functions
<fenv.h> ------- Set of functions for controlling the floating-point environment
<erno.h> ------- For testing error codes
<tgmath.h> ----- Type-generic mathematical functions
<stdatomic.h> -- For atomic operations on data shared between threads
<stdnoreturn.h> -For specifying non-returning functions

C STANDARD LIBRARY FUNCTIONS

There are lots of standard library functions available in C to perform a lot of tasks easily. In a library, the actual functionality is implemented. For example, when we use any mathematics function we include math.h header file but in actual some math library libm.lib, libmmd.lib contain the body of the function. The standard library functions are built-in functions in C programming to handle tasks such as mathematical computations, I/O processing, string handling etc.you can also declare your own functions either in the program or in an external file with the .h extension called a header file.

ADVANTAGES OF C STANDARD LIBRARY FUNCTIONS
Performs a specific operation
To get the pre-defined output instead of writing our own code to get those outputs
Easy to use
The functions are portable
Create the most efficient code optimized for maximum performance
Save development time.

Examples of using the m.h header file
	double acos(double x)
Returns the arc cosine of x in radians.

2	double asin(double x)
Returns the arc sine of x in radians.

3	double atan(double x)
Returns the arc tangent of x in radians.

4	double atan2(double y, double x)
Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant.

5	double cos(double x)
Returns the cosine of a radian angle x.

6	double cosh(double x)
Returns the hyperbolic cosine of x.

7	double sin(double x)
Returns the sine of a radian angle x.

8	double sinh(double x)
Returns the hyperbolic sine of x.

9	double tanh(double x)
Returns the hyperbolic tangent of x.

10	double exp(double x)
Returns the value of e raised to the xth power.

11	double frexp(double x, int *exponent)
The returned value is the mantissa and the integer pointed to by exponent is the exponent. The resultant value is x = mantissa * 2 ^ exponent.

12	double ldexp(double x, int exponent)
Returns x multiplied by 2 raised to the power of exponent.

13	double log(double x)
Returns the natural logarithm (base-e logarithm) of x.

14	double log10(double x)
Returns the common logarithm (base-10 logarithm) of x.

15	double modf(double x, double *integer)
The returned value is the fraction component (part after the decimal), and sets integer to the integer component.

16	double pow(double x, double y)
Returns x raised to the power of y.

17	double sqrt(double x)
Returns the square root of x.

18	double ceil(double x)
Returns the smallest integer value greater than or equal to x.

19	double fabs(double x)
Returns the absolute value of x.

20	double floor(double x)
Returns the largest integer value less than or equal to x.

21	double fmod(double x, double y)
Returns the remainder of x divided by y.
FLT_ROUNDS

Defines the rounding mode for floating point addition and it can have any of the following values −

-1 − indeterminable
0 − towards zero
1 − to nearest
2 − towards positive infinity
3 − towards negative infinity
2	
FLT_RADIX 2

This defines the base radix representation of the exponent. A base-2 is binary, base-10 is the normal decimal representation, base-16 is Hex.

3	
FLT_MANT_DIG

DBL_MANT_DIG

LDBL_MANT_DIG

These macros define the number of digits in the number (in the FLT_RADIX base).

4	
FLT_DIG 6

DBL_DIG 10

LDBL_DIG 10

These macros define the maximum number decimal digits (base-10) that can be represented without change after rounding.

5	
FLT_MIN_EXP

DBL_MIN_EXP

LDBL_MIN_EXP

These macros define the minimum negative integer value for an exponent in base FLT_RADIX.

6	
FLT_MIN_10_EXP -37

DBL_MIN_10_EXP -37

LDBL_MIN_10_EXP -37

These macros define the minimum negative integer value for an exponent in base 10.

7	
FLT_MAX_EXP

DBL_MAX_EXP

LDBL_MAX_EXP

These macros define the maximum integer value for an exponent in base FLT_RADIX.

8	
FLT_MAX_10_EXP +37

DBL_MAX_10_EXP +37

LDBL_MAX_10_EXP +37

These macros define the maximum integer value for an exponent in base 10.

9	
FLT_MAX 1E+37

DBL_MAX 1E+37

LDBL_MAX 1E+37

These macros define the maximum finite floating-point value.

10	
FLT_EPSILON 1E-5

DBL_EPSILON 1E-9

LDBL_EPSILON 1E-9

These macros define the least significant digit representable.

11	
FLT_MIN 1E-37

DBL_MIN 1E-37

LDBL_MIN 1E-37

These macros define the minimum floating-point values.

Example
The following example shows the usage of few of the constants defined in float.h file.

 Live Demo
#include <stdio.h>
#include <float.h>

int main () {
   printf("The maximum value of float = %.10e\n", FLT_MAX);
   printf("The minimum value of float = %.10e\n", FLT_MIN);

   printf("The number of digits in the number = %.10e\n", FLT_MANT_DIG);
}
Let us compile and run the above program that will produce the following result −

The maximum value of float = 3.4028234664e+38
The minimum value of float = 1.1754943508e-38
The number of digits in the number = 7.2996655210e-312
Library Functions
Following are the functions defined in the header stdio.h −

Follow the same sequence of functions for better understanding and to make use of Try it(Online compiler) option, because file created in the first function will be used in subsequent functions.
<stdio.h> library function
Sr.No.	Function & Description
1	int fclose(FILE *stream)
Closes the stream. All buffers are flushed.

2	void clearerr(FILE *stream)
Clears the end-of-file and error indicators for the given stream.

3	int feof(FILE *stream)
Tests the end-of-file indicator for the given stream.

4	int ferror(FILE *stream)
Tests the error indicator for the given stream.

5	int fflush(FILE *stream)
Flushes the output buffer of a stream.

6	int fgetpos(FILE *stream, fpos_t *pos)
Gets the current file position of the stream and writes it to pos.

7	FILE *fopen(const char *filename, const char *mode)
Opens the filename pointed to by filename using the given mode.

8	size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Reads data from the given stream into the array pointed to by ptr.

9	FILE *freopen(const char *filename, const char *mode, FILE *stream)
Associates a new filename with the given open stream and same time closing the old file in stream.

10	int fseek(FILE *stream, long int offset, int whence)
Sets the file position of the stream to the given offset. The argument offset signifies the number of bytes to seek from the given whence position.

11	int fsetpos(FILE *stream, const fpos_t *pos)
Sets the file position of the given stream to the given position. The argument pos is a position given by the function fgetpos.

12	long int ftell(FILE *stream)
Returns the current file position of the given stream.

13	size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Writes data from the array pointed to by ptr to the given stream.

14	int remove(const char *filename)
Deletes the given filename so that it is no longer accessible.

15	int rename(const char *old_filename, const char *new_filename)
Causes the filename referred to, by old_filename to be changed to new_filename.

16	void rewind(FILE *stream)
Sets the file position to the beginning of the file of the given stream.

17	void setbuf(FILE *stream, char *buffer)
Defines how a stream should be buffered.

18	int setvbuf(FILE *stream, char *buffer, int mode, size_t size)
Another function to define how a stream should be buffered.

19	FILE *tmpfile(void)
Creates a temporary file in binary update mode (wb+).

20	char *tmpnam(char *str)
Generates and returns a valid temporary filename which does not exist.

21	int fprintf(FILE *stream, const char *format, ...)
Sends formatted output to a stream.

22	int printf(const char *format, ...)
Sends formatted output to stdout.

23	int sprintf(char *str, const char *format, ...)
Sends formatted output to a string.

24	int vfprintf(FILE *stream, const char *format, va_list arg)
Sends formatted output to a stream using an argument list.

25	int vprintf(const char *format, va_list arg)
Sends formatted output to stdout using an argument list.

26	int vsprintf(char *str, const char *format, va_list arg)
Sends formatted output to a string using an argument list.

27	int fscanf(FILE *stream, const char *format, ...)
Reads formatted input from a stream.

28	int scanf(const char *format, ...)
Reads formatted input from stdin.

29	int sscanf(const char *str, const char *format, ...)
Reads formatted input from a string.

30	int fgetc(FILE *stream)
Gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.

31	char *fgets(char *str, int n, FILE *stream)
Reads a line from the specified stream and stores it into the string pointed to by str. It stops when either (n-1) characters are read, the newline character is read, or the end-of-file is reached, whichever comes first.

32	int fputc(int char, FILE *stream)
Writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the stream.

33	int fputs(const char *str, FILE *stream)
Writes a string to the specified stream up to but not including the null character.

34	int getc(FILE *stream)
Gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.

35	int getchar(void)
Gets a character (an unsigned char) from stdin.

36	char *gets(char *str)
Reads a line from stdin and stores it into the string pointed to by, str. It stops when either the newline character is read or when the end-of-file is reached, whichever comes first.

37	int putc(int char, FILE *stream)
Writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the stream.

38	int putchar(int char)
Writes a character (an unsigned char) specified by the argument char to stdout.

39	int puts(const char *str)
Writes a string to stdout up to but not including the null character. A newline character is appended to the output.

40	int ungetc(int char, FILE *stream)
Pushes the character char (an unsigned char) onto the specified stream so that the next character is read.

41	void perror(const char *str)
Prints a descriptive error message to stderr. First the string str is printed followed by a colon and then a space.

 

#include <stdio.h>//1) you must still use the <stdio.h> file
#include <string.h>
int main()
{
    char c[20];
    printf("Enter string: ");
    gets(c);
    printf("Length of string c = %d \n",strlen(c));
    return 0;
}
//Output: If I type "FAIAZ TUTORING INC" gives me 18.//

CLASSIFICATION OF LIBRARY FUNCTIONS

C Input Output Functions – transfer data between the C program and standard input/output devices.
C String Character Functions – String.h header file supports all the string functions in C language.
C Time Date Localization Functions –  implementing date and time manipulation operations.
C Dynamic Memory Allocation Functions – dynamic memory allocation defined as the process of allocating memory during program execution.
C INPUT OUTPUT FUNCTIONS
Function	Description
scanf	read character, string, numeric data from a keyboard
printf	print the “character, string, float, integer, octal and hexadecimal values” onto the output screen
getchar	reads a character from the terminal and returns it as an integer
putchar	displays the character passed to it on the screen
gets	reads a line from stdin(standard input) into the buffer
puts	writes the string str and a trailing newline to stdout.

C STRING CHARACTER FUNCTIONS
Function	Description
strcat	concatenate two strings.
strchr	string scanning operation.
strcmp	compare two strings.
strcpy	copy a string.
strlen	get string length.
strncat	concatenate one string with part of another.
strncmp	compare parts of two strings.

C TIME DATE LOCALIZATION FUNCTIONS
Function	Description
asctime	time is converted into a string.
clock	get current system time
ctime	return string that contains date and time information
difftime	get the difference between two given times
getdate	get the CPU time
gmtime	shares the tm structure that contains date and time information (UTC)
localtime	shares the tm structure that contains date and time information(Local-Time)
mktime	interprets tm structure as calendar time
setdate	modify the system date
strftime	modify the actual time format
time	get current system time as the structure
C DYNAMIC MEMORY ALLOCATION FUNCTIONS
Function	Description
malloc	Allocates requested size of bytes and returns a pointer first byte of allocated space
calloc	Allocates space for an array of elements initializes to zero and then returns a pointer to memory
free	deallocate the previously allocated space
realloc	Change the size of the previously allocated space
How to write your own header file in C?
As we all know that files with .h extension are called header files in C. These header files generally contain function declarations which we can be used in our main C program, like for e.g. there is need to include stdio.h in our C program to use function printf() in the program. So the question arises, is it possible to create your own header file?

The answer to the above is yes. header files are simply files in which you can declare your own functions that you can use in your main program or these can be used while writing large C programs.
NOTE:Header files generally contain definitions of data types, function prototypes and C preprocessor commands.

Below is the short example of creating your own header file and using it accordingly.

Creating myhead.h : Write the below code and then save the file as myhead.h or you can give any name but the extension should be .h indicating its a header file.
filter_none
brightness_4
// It is not recommended to put function definitions  
// in a header file. Ideally there should be only 
// function declarations. Purpose of this code is 
// to only demonstrate working of header files. 
void add(int a, int b) 
{ 
    printf("Added value=%d\n", a + b); 
} 
void multiply(int a, int b) 
{ 
    printf("Multiplied value=%d\n", a * b);
    } 
Including the .h file in other program : Now as we need to include stdio.h as #include in order to use printf() function. We will also need to include the above header file myhead.h as #include”myhead.h”. The ” ” here are used to instructs the preprocessor to look into the present folder and into the standard folder of all header files if not found in present folder. So, if you wish to use angular brackets instead of ” ” to include your header file you can save it in the standard folder of header files otherwise. If you are using ” ” you need to ensure that the header file you created is saved in the same folder in which you will save the C file using this header file.
Using the created header file :
filter_none
edit
play_arrow

brightness_4
// C program to use the above created header file 
#include <stdio.h> 
#include "myhead.h" 
int main() 
{ 
    add(4, 6); 
  
    //This calls add function written in myhead.h   
      and therefore no compilation error.//
    multiply(5, 5); 
    // Same for the multiply function in myhead.h 
    printf("Thanks for watching my video"); 
    return 0; 
} 
Output:

Added value:10
Multiplied value:25
Thanks for watching my video
 

Did You 
 variable type          format specifiers
  int                       %d
  float                     %f
  double                    %lf
  char                      %c
  string                    %s
  */
 /* Character format specifier uses %c
 #include <stdio.h> 
int main() 
{ 
	char ch = 'A'; 
	printf("%c\n", ch); 
	return 0; 
} */

 /* Integer format specifier uses %d,%i
  #include <stdio.h> 
int main() 
{ 
	int x = 45, y = 90; 
	printf("%d\n", x); 
	printf("%i\n", x); 
	return 0; 
} */
/*Double format specifier uses %lf,%e or %E
#include <stdio.h> 
int main() 
{ 
	double a = 12.67; 
	printf("%lf\n", a); 
	printf("%e\n", a); 
	return 0; 
} */

/*Unsigned octal number 
#include <stdio.h> 
int main() 
{ 
	int a = 67; 
	printf("%o\n", a); 
	return 0; 
} 
*/
/*
#include <stdio.h> 
int main() 
{ 
	int a = 15; 
	printf("%x\n", a); 
	return 0; 
} */
/*#include <stdio.h> 
int main() 
{ 
	char a[] = "geeksforgeeks"; 
	printf("%s\n", a); 
	return 0; 
} 
*/
/*#include <stdio.h> 
int main() 
{ 
	char str[] = "geeksforgeeks"; 
	printf("%20s\n", str); 
	printf("%-20s\n", str); 
	printf("%20.5s\n", str); 
	printf("%-20.5s\n", str); 
	return 0; 
} 
*/
/*#include <stdio.h> 
int main() 
{ 
	int a = 0; 
	scanf("%d", &a); // input is 45 
	printf("%d\n", a); 
	return 0; 
} 
*/
/*#include <stdio.h> 
int main() 
{ 
	int a = 0; 
	scanf("%i", &a); // input is 017 (octal of 15 ) 
	printf("%d\n", a); 
	scanf("%i", &a); // input is 0xf (hexadecimal of 15 ) 
	printf("%d\n", a); 
	return 0; 
} 
*/
/*#include <stdio.h> 
int main() 
{ 
	float a = 0.0; 
	scanf("%f", &a); // input is 45.65 
	printf("%f\n", a); 
	return 0; 
}
#include <stdio.h> 
int main() 
{ 
	char str[20]; 
	scanf("%s", str); // input is geeksforgeeks 
	printf("%s\n", str); 
	return 0; 
} 
#include <stdio.h> 
int main() 
{ 
	char ch; 
	scanf("%c", &ch); // input is A 
	printf("%c\n", ch); 
	return 0; 
} 

*/



/*
  
#include "stdio.h"
#include "stdlib.h"
#include "math.h"

int main(void) 
{
  printf("Hello /n world\n");//one string(written using one double quotation//
  printf("Hello\n""World");//use of 2 double quotation to separate the 2 words in 2 lines//
  printf("\n");//printf line is worth an extra line//
  printf("Hello""\n""World\n");//use of 3 quotation to separate the 2 words using the \n //
  printf(" My number is 500\n");//written using complete strings//
  printf(" My number is %d\n", 500);//Written using format specifier and 500 declared as the integer stored by the integer formatspecifier //
  printf(" My %s is %d\n","number", 500);//There are 2 format specifiers one for string and the otyher for integer////If I also add another\n after the "number" then the is 50 comes down//
  printf(" My %s is %d\n","number\n", 500);
  printf("%f\n", 7.6);
   printf(" My %s is %f\n","number\n", 500.897);
  int favnum = 50;
  printf("My %s is %d\n","favnum", favnum);
  char mychar = 'i';
  int favnum2 = 90;
  printf("my favourite %c is %d\n", mychar , favnum2);
  int favnum3 = 86;
  printf("my favourite %c is %d\n", mychar , favnum3);//For my compiler instead of referring to favnum3 it's referring to a previous float number//
   printf("%f\n", 7.6 + 4.4);
   printf("%f\n", 7.6 - 4.4);
   printf("%f\n", 7.6 * 4.4);
   printf("%f\n", 7.6 / 4.4);
   printf("%d\n", 7/ 4);//four can only go into 7 completely once//
   printf("%f\n", 7/ 4.0);//four can only go into 7 completely once and the rest of the answers are also considered for qquotient//
   printf("%d\n", 7% 4);//the remainder of the division between 7 by 4 is 3// */
  int num=69;
   printf("%d\n", num);
   printf("%f\n", pow(2,3) );//math.h header rquired for this compiler and some compilers dont require it like code blocks also the arguments in pow  or the input parameters are of the type double//
  // printf("%d\n", pow(2,3) );If i assign %d format specifier for this type of argument it gives error//

  printf("%f\n", sqrt(36) );// retuns value of 6

  printf("%f\n", ceil(36.56) );//returns value of 37

  printf("%f\n", floor(36.56) );//retuns a value of 36

  int num2 = 8;
  printf("%d\n", num2);
  num2=9;
  printf("%d", num2);
  const int fav_num = 123;//const function doesn't do anything in this compiler //
  printf("%d\n", fav_num);
  num2=9;
  printf("%d\n", num2);
  //Getting user input//
  int age;
  printf("Enter age\n");
  scanf("%d\n", &age);
  printf("You are %d years old\n", age);
  return(0);
  }*/
  /*
  PROMPTING (OBTAINING USER INPUT)
  #include <stdio.h>
  int main(void)
  {
    int i;//declarations required for storing value to a specific type of location in this case integer i will be assigned value by the user.
    double j;//
    char k;
    char l[]; 
    Printf("Enter  an integer");//prompting or asking user to enter number
    scanf("%d", &i)//"%d" is the interger format specifier which prints the integer and &i stores the value of the integer assigned to i//
    
    Printf("Enter  a decimal number");//
    scanf("%lf", &j);//

    printf("Etera character");//
    scanf("%c", &k);//

    Printf("Enter  a string");//
    scanf("%s",&l);//

    printf("Enter a floating decimal number(same as a decimal number)");//
    scanf("%f", &m);//
}
return(0);
}*/
/*#include <stdio.h>
int min(void)
{
    int phone_number, student_id, youtube_videos_browsed;
    double age, height, gpa;
    float marks, class_average;
    char grade, gender, section;
    char brasize[]; 
  //Don't leave blank space between words that require separation just use _(underscore) to bridge the space.//
  {
    printf(" Enter phone_number, student_id and number of videos browsed");
    scanf("%d%d%d", &phone_number, &student_id, &youtube_videos_browsed);
    //Notice how I made the user input 3 information using merely just 1 printf statement and scanf statement.//
    //You can also write them separately like I previously showed you but the process is time consuming//

    printf("Your phone number is %d your student_id is %d and your youtube_videos_browsed is %d ", phone_number, student_id, youtube_videos);//IMPORTANT All the variables must be written in oder of their declarations//
    printf("Enter age , height, and gpa");
    scanf("%lf%lf%lf", &age, &height, &gpa);
    printf("Your age is %lf, your height is %lf and your gpa is %lf", age,height,gpa);////IMPORTANT All the variables must be written in oder of their declarations//
    printf("Enter marks, class_average");
    scanf("%f%f", &marks, &class_average );
    printf("Enter grade, gender and your section");
    scanf("%c%c%c", &grade,&gender,&section);
    printf("grade is %c, your gender is %c and your section is %c");//IMPORTANT All the variables must be written in oder of their declarations//
    char name[20];
    Printf("Enter name");
    fgets("%s", name);
    printf("your name is %s", name);

  }
  return(0);
  }*/

  //https://www.youtube.com/watch?v=KJgsSFOSQv0//
  //https://www.tutorialspoint.com/c_standard_library/time_h//