-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.c
483 lines (362 loc) · 8.13 KB
/
code.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
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<%
string micadena = "gola";
if (d3->inch >= 12) { /* if inch is greater or equal to 12, converting it to feet. */
d3->inch -= 12;
//++d3->feet;
}
int main(){
int* pc;
int c;
c=22;
printf("Address of c:%u\n",&c);
printf("Value of c:%d\n\n",c);
pc= &c;
printf("Address of pointer pc:%u\n",pc);
printf("Content of pointer pc:%d\n\n",*pc);
c=11;
printf("Address of pointer pc:%u\n",pc);
printf("Content of pointer pc:%d\n\n",*pc);
*pc=2;
printf("Address of c:%u\n",&c);
printf("Value of c:%d\n\n",c);
return 0;
}
void add(struct distance d1,struct distance d2, struct distance *d3)
{
//Adding distances d1 and d2 and storing it in d3
d3->feet = d1.feet + d2.feet;
d3->inch = d1.inch + d2.inch;
if (d3->inch >= 12) { /* if inch is greater or equal to 12, converting it to feet. */
d3->inch -= 12;
//++d3->feet;
}
}
void display(struct student stu){
printf("Output\nName: %s",stu.name);
printf("\nRoll: %d",stu.roll);
}
bool x = a>b;
c = a % b;
b= (-1) * 3 + (-5)%3;
date mifecha = #20-02-1993#;
int *ip = &var;
int a = -4;
int b = -3;
#include "stdio.h"
const char x = 'x';
c <<= 2;
//a++;
int i, j , k;
x = a * b - c ;
y = b / c * a ;
z = a - b / c + d;
head.x=25;
head->y=20;
head.direction=RIGHT;
bool x= !true;
int main ()
{
float a, b, c, x, y, z;
a = 9;
b = 12;
c = 3;
x = a - b / 3 + c * 2 - 1;
y = a - b / (3 + c) * (2 - 1);
z = a - ( b / (3 + c) * 2) - 1;
printf ("x = %fn",x);
printf ("y = %fn",y);
printf ("z = %fn",z);
}
int a =2;
int mult (int x, int y)
{
return x * y;
}
int main () {
/* local variable definition */
int a = 100;
/* check the boolean condition */
if( a == 10 ) {
/* if condition is true then print the following */
printf("Value of a is 10\n" );
}
else if( a == 20 ) {
/* if else if condition is true */
printf("Value of a is 20\n" );
}
else if( a == 30 ) {
/* if else if condition is true */
printf("Value of a is 30\n" );
}
else {
/* if none of the conditions is true */
printf("None of the values is matching\n" );
}
printf("Exact value of a is: %d\n", a );
return 0;
}
void swap(int a, int b)
{
int tmp;
tmp = a;
a = b;
b = tmp;
printf(" \nvalues after swap m = %d\n and n = %d", a, b);
}
int max(int num1, int num2) {
/* local variable declaration */
int result;
if (num1 == num2)
result = num1;
else
result = num2;
return result;
}
/* check the boolean condition */
if( a < 20 ) {
/* if condition is true then print the following */
printf("a is less than 20\n" );
}
else {
/* if condition is false then print the following */
printf("a is not less than 20\n" );
}
for( a = 10; a < 20; a = a + 1 ){
//printf("value of a: %d\n", a);
result = num1;
}
int main () {
int a;
/* for loop execution */
for( a = 10; a < 20; a = a + 1 ){
printf("value of a: %d\n", a);
}
return 0;
}
if(boolean_expression ) {
/* Executes when the boolean expression 1 is true */
}
else if( boolean_expression ) {
/* Executes when the boolean expression 2 is true */
}
else if( boolean_expression ) {
/* Executes when the boolean expression 3 is true */
}
else {
/* executes when the none of the above condition is true */
}
int *length;
int bend_no;
int a[5] ;
//int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
int len [] [10] ;
//int len2 [] = {4};
int a[][2];
int a[5] ;
char key;
int i, j , k;
char c;
float f, salary;
double d;
int a[5][2];
enum colors {RED=1, YELLOW, GREEN=6, BLUE };
//const int a =2;
int a =2;
int d = 3, f = 5; // definition and initializing d and f.
const char x = 'x'; // the variable x has the value 'x'.
/* function returning the max between two numbers */
int max(int num1, int num2) {
/* local variable declaration */
int result;
if (num1 == num2)
result = num1;
else
result = num2;
return result;
}
void record(){
int x;
}
int life;
void Delay(long car){
int c;
}
void gotoxy(int x, int y){
}
int Scoreonly(){
int z;
}
struct coordinate{
int x;
int y;
int direction;
};
for (string item : someList) {
char key;
Print();
// system("cls");
loaduno(key);
}
int main () {
/* local variable definition */
int a = 10;
/* while loop execution */
while( a < 20 ) {
printf("value of a: %d\n", a);
//a++;
int tmp;
}
return 0;
}
int main () {
/* local variable definition */
int a = 10;
/* do loop execution */
do {
printf("value of a: %d\n", a);
a = a + 1;
}while( a < 20 );
return 0;
}
int main()
{
int x;
x = 0;
do {
/* "Hello, world!" is printed at least one time
even though the condition is false */
printf( "Hello, world!\n" );
} while ( x != 0 );
getchar();
}
int main () {
/* local variable definition */
char grade = 'B';
switch(grade) {
case 'A' :
printf("Excellent!\n" );
break;
case 'B' :
case 'C' :
printf("Well done\n" );
break;
case 'D' :
printf("You passed\n" );
break;
case 'F' :
printf("Better try again\n" );
char grade = 'B';
break;
default :
printf("Invalid grade\n" );
}
printf("Your grade is %c\n", grade );
return 0;
}
while (true)
{
take_turn(player1);
take_turn(player2);
}
take_turn(uno,dos,tres);
while(true)
{
if (someone_has_won() || someone_wants_to_quit() == TRUE)
{break;}
take_turn(player1);
if (someone_has_won() || someone_wants_to_quit() == TRUE)
{break;}
take_turn(player2);
}
a= suma();
b=suma(x,y);
int main() {
int rad;
float PI = 3.14, area, ci;
printf("\nEnter radius of circle: ");
scanf("%d", &rad);
area = PI * rad * rad;
printf("\nArea of circle : %f ", area);
ci = 2 * PI * rad;
printf("\nCircumference : %f ", ci);
return (0);
}
int main () {
/* local variable definition */
int a = 100;
int b = 200;
/* check the boolean condition */
if( a == 100 ) {
/* if condition is true then check the following */
if( b == 200 ) {
/* if condition is true then print the following */
printf("Value of a is 100 and b is 200\n" );
}
}
printf("Exact value of a is : %d\n", a );
printf("Exact value of b is : %d\n", b );
return 0;
}
int main () {
/* local variable definition */
int a = 100;
int b = 200;
switch(a) {
case 100:
printf("This is part of outer switch\n", a );
switch(b) {
case 200:
printf("This is part of inner switch\n", a );
}
}
printf("Exact value of a is : %d\n", a );
printf("Exact value of b is : %d\n", b );
return 0;
}
int main() {
const int LENGTH = 10;
const int WIDTH = 5;
const char NEWLINE = '\n';
int area;
area = LENGTH * WIDTH;
printf("value of area : %d", area);
printf("%c", NEWLINE);
return 0;
}
int main () {
int n[ 10 ]; /* n is an array of 10 integers */
int i,j;
/* initialize elements of array n to 0 */
for ( i = 0; i < 10; i ) {
n[ i ] = i + 100; /* set element at location i to i + 100 */
}
/* output each array element's value */
for (j = 0; j < 10; j) {
printf("Element[%d] = %d\n", j, n[j] );
}
return 0;
}
int main () {
int n[ 10 ]; /* n is an array of 10 integers */
int i,j;
/* initialize elements of array n to 0 */
for ( i = 0; i < 10; i ) {
n[ i ] = i + 100; /* set element at location i to i + 100 */
}
/* output each array element's value */
for (j = 0; j < 10; j) {
printf("Element[%d] = %d\n", j, head.hoja );
}
return 0;
}
%>
</body>
</html>