├── README.md ├── loop.c ├── Hello_World.c ├── ternary_operator.c ├── 1D_Array.c ├── 2D_Array.c ├── if_else.c └── conditional_statement.c /README.md: -------------------------------------------------------------------------------- 1 | # C-tutorial 2 | C Language Practice 3 | -------------------------------------------------------------------------------- /loop.c: -------------------------------------------------------------------------------- 1 | # include 2 | 3 | int main() { 4 | int n; 5 | printf("Enter the value of n: "); 6 | scanf("%d",&n); 7 | 8 | for (int i=0; i 2 | 3 | int main(){ 4 | printf("Hello World"); 5 | printf("Welcome to my repository"); 6 | printf("I am Learning C Programming"); 7 | printf("Hello Github"); 8 | printf("I am a CSE student"); 9 | printf("Bye"); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ternary_operator.c: -------------------------------------------------------------------------------- 1 | # include 2 | 3 | int main() { 4 | int age; 5 | printf("Enter Your age: "); 6 | scanf("%d",&age); 7 | age >= 18 ? printf("You are Eligible to Vote") : printf("You are Not Eligible to Vote"); 8 | return 0; 9 | } 10 | 11 | 12 | // Example of teranary operator 13 | -------------------------------------------------------------------------------- /1D_Array.c: -------------------------------------------------------------------------------- 1 | # include 2 | 3 | int main() { 4 | int n; 5 | printf("Enter the length of an array: "); 6 | scanf("%d",&n); 7 | 8 | printf("Enter the %d numbers in the array: ",n); 9 | int arr[n]; 10 | for (int i=0; i 2 | 3 | int main() { 4 | int n; 5 | printf("Enter the number of row & coloumn matrix you want to form: "); 6 | scanf("%d",&n); 7 | 8 | int arr[n][n]; 9 | for (int i=0; i 2 | 3 | // Find your Grade. 4 | int main() { 5 | int marks; 6 | printf("Enter your marks: "); 7 | scanf("%d",&marks); 8 | 9 | if (marks>=90 && marks<=100) { 10 | printf("Grade: O"); 11 | } 12 | else if (marks>=80 && marks<=89) { 13 | printf("Grade: A"); 14 | } 15 | else if (marks>=70 && marks<=79) { 16 | printf("Grade: B"); 17 | } 18 | else if (marks>=60 && marks<=69) { 19 | printf("Grade: C"); 20 | } 21 | else if (marks>=50 && marks<=59) { 22 | printf("Grade: D"); 23 | } 24 | else if (marks>=40 && marks<=49) { 25 | printf("Grade: E"); 26 | } 27 | else if (marks>=0 && marks<40) { 28 | printf("You are Fail"); 29 | } 30 | else { 31 | printf("Invalid input"); 32 | } 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /conditional_statement.c: -------------------------------------------------------------------------------- 1 | 2 | # include 3 | 4 | int main() { 5 | int marks; 6 | printf("Enter your marks: "); // On the behalf of your marks you can select your specialisation. 7 | scanf("%d",&marks); 8 | 9 | if (marks>=85 && marks<=100) { 10 | printf("You are eligible to take Cyber Security"); 11 | } 12 | else if (marks>=75 && marks<85) { 13 | printf("You are eligible to take Data Science but you are not eligible to take Cyber Security"); 14 | } 15 | else if (marks>=40 && marks<75) { 16 | printf("You are eligible for specilization except Data Science and Cyber Security"); 17 | } 18 | else if (marks>=0 && marks<40) { 19 | printf("You are not eligibke for any of the specialization, First clear your Backlog"); 20 | } 21 | else { 22 | printf("Invalid input"); 23 | } 24 | 25 | return 0; 26 | 27 | } 28 | --------------------------------------------------------------------------------