C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, including operating systems, as well as various application software for computers ranging from supercomputers to embedded systems.
C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. It has since become one of the most widely used programming languages of all time, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and subsequently by the International Organization for Standardization (ISO).
There are many books you can refer to get started with C Programming:
Even though all answers are given, try slving the problems by yourself, even before looking at the answer.
Try out some good problems. Do them yourself, if you get stuck somewhere, the answers are always there.
- Assignment on conditional statements in C
- Assignment on Looping statements in C
- Assignment on Arrays and strings in C
- Assignment on Structures and functions in C
- Take A Test 1
-
Factorial of a given number
LOGIC: use recursive functionsint factorial(int n) { if(n>1) return n*factorial(n-1); else return 1; }
-
Prime Number
LOGIC: Use for loop till n/2 elementsfor(i=2;i<=n/2;i++) { if(n%i == 0){ flag = 1; break; } }
-
Fibonacci Series
LOGIC: Use for loopfor(i=1;i<=n;i++) { if(i<3) a3=1; else { a3=a2+a1; a1=a2; a2=a3; } }
-
Sum of elements in array
LOGIC: Use for loopfor(i=0;i<n;i++) { sum+=a[i]; }
-
Duplicate elements of an array
LOGIC: Use for loopfor(i=0;i<n;i++) { b[i]=a[i]; }
-
Array Reversal
LOGIC:Use temp variablefor(i=0,j=n-1;i<n/2;i++,j--) { temp=a[i]; a[i]=a[j]; a[j]=temp; }
-
Multi dimensional array input
LOGIC: Use nested loopsfor(i=0;i<r;i++) { for(j=0;j<c;j++) scanf("%d",&A[i][j]); }
-
Sum of matrix
LOGIC: Add individual elementfor(i=0;i<r;i++) { for(j=0;j<c;j++){ scanf("%d",&B[i][j]); sum[i][j] = A[i][j]+B[i][j]; } }
-
String operations in C
c strlen(); strrev(); strcpy(); strcat(); strcmp();
-
Number of vowels in a given line
LOGIC: Use if conditionfor(i=0;i<len;i++) { if(line[i] == 'a' || ......... || line[i] == 'U') { count++; } }
-
Input the DOB in DDMMYYYY, find n, n is equal to the sum of digits until the sum is single digit
Go Back{: .btn}