This document contains references to observing code samples that demonstrate various Python programming concepts, including calculating areas and circumferences of circles, using arithmetic expressions, the ternary operator, quadratic equations, determining if a number is positive or negative, factorials, Fibonacci sequences, adding matrices, summing arrays of natural numbers, comparing and copying strings, calculating string lengths, using built-in functions for operations like square, square root, log and exponential, printing triangles, calculating squares of integers from 1 to 100, and basic file handling functions.
This document contains references to observing code samples that demonstrate various Python programming concepts, including calculating areas and circumferences of circles, using arithmetic expressions, the ternary operator, quadratic equations, determining if a number is positive or negative, factorials, Fibonacci sequences, adding matrices, summing arrays of natural numbers, comparing and copying strings, calculating string lengths, using built-in functions for operations like square, square root, log and exponential, printing triangles, calculating squares of integers from 1 to 100, and basic file handling functions.
This document contains references to observing code samples that demonstrate various Python programming concepts, including calculating areas and circumferences of circles, using arithmetic expressions, the ternary operator, quadratic equations, determining if a number is positive or negative, factorials, Fibonacci sequences, adding matrices, summing arrays of natural numbers, comparing and copying strings, calculating string lengths, using built-in functions for operations like square, square root, log and exponential, printing triangles, calculating squares of integers from 1 to 100, and basic file handling functions.
This document contains references to observing code samples that demonstrate various Python programming concepts, including calculating areas and circumferences of circles, using arithmetic expressions, the ternary operator, quadratic equations, determining if a number is positive or negative, factorials, Fibonacci sequences, adding matrices, summing arrays of natural numbers, comparing and copying strings, calculating string lengths, using built-in functions for operations like square, square root, log and exponential, printing triangles, calculating squares of integers from 1 to 100, and basic file handling functions.
Area and circumference of the circle. REFER OBSERVATION
Arithmetic expression REFER OBSERVATION Ternary Operator REFER OBSERVATION Quadratic equation. REFER OBSERVATION Given number is positive or negative. REFER OBSERVATION Factorial REFER OBSERVATION Fibonacci REFER OBSERVATION Addition of two matrices REFER OBSERVATION sum of natural numbers using array REFER OBSERVATION String Compare OUTPUT: #include<stdio.h> #include<string.h> int main() { char a[100], b[100]; printf("Enter the first string\n"); Enter the first string gets(a); deep learning printf("Enter the second string\n"); Enter the second string gets(b); deep learning if( strcmp(a,b) == 0 ) Entered strings are equal. printf("Entered strings are equal.\n"); else printf("Entered strings are not equal.\n"); return 0; }
STRING COPY OUTPUT:
#include <stdio.h> Enter the string #include <string.h> hi all int main() string: hi all { Copied string: hi all char A[100], copy[100]; printf("Enter the string\n"); gets(A); strcpy(copy, A); printf("string: %s\n", A); printf("Copied string: %s\n", copy); return 0; } STRING LENGTH OUTPUT: #include <stdio.h> Length of the string: 23 int main() { char s[] = "Artificial Intelligence"; int i; for (i = 0; s[i] != '\0'; ++i); printf("Length of the string: %d", i); return 0; } To find square, square root, log, exponential using in-built functions REFER OBSERVATION print the first and rows of triangle Enter number of rows: 3 #include <stdio.h> * int main() ** { *** int i, j, rows; printf("Enter number of rows: "); scanf("%d",&rows); for(i=1; i<=rows; ++i) { for(j=1; j<=i; ++j) { printf("* "); } printf("\n"); } return 0; } Square of integer from 1 to 100. REFER OBSERVATION Basic functions of file handling. REFER OBSERVATION