Skip to content

Latest commit

 

History

History
 
 

reviseC

C Programming

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).

Getting started with C

There are many books you can refer to get started with C Programming:

NOTE*

Even though all answers are given, try slving the problems by yourself, even before looking at the answer.

Confident On Your Skiils? Test Them

Try out some good problems. Do them yourself, if you get stuck somewhere, the answers are always there.

  1. Assignment on conditional statements in C
  2. Assignment on Looping statements in C
  3. Assignment on Arrays and strings in C
  4. Assignment on Structures and functions in C
  5. Take A Test 1

Begginer? Try out some basic programs in C

  1. Factorial of a given number
    LOGIC: use recursive functions

    int factorial(int n) {
       if(n>1) return n*factorial(n-1);
       else return 1;
    } 
  2. Prime Number
    LOGIC: Use for loop till n/2 elements

      for(i=2;i<=n/2;i++) {
        if(n%i == 0){
            flag = 1;
            break;
        }
      }
  3. Fibonacci Series
    LOGIC: Use for loop

      for(i=1;i<=n;i++) {
        if(i<3) a3=1;
        else {
            a3=a2+a1;
            a1=a2;
            a2=a3;
        }
      }
  4. Sum of elements in array
    LOGIC: Use for loop

    for(i=0;i<n;i++) {
      sum+=a[i];
    } 
  5. Duplicate elements of an array
    LOGIC: Use for loop

    for(i=0;i<n;i++) {
      b[i]=a[i];
    }
  6. Array Reversal
    LOGIC:Use temp variable

        for(i=0,j=n-1;i<n/2;i++,j--) {
          temp=a[i];
          a[i]=a[j];
          a[j]=temp;
        }
  7. Multi dimensional array input
    LOGIC: Use nested loops

      for(i=0;i<r;i++) {
          for(j=0;j<c;j++)
              scanf("%d",&A[i][j]);
      }
  8. Sum of matrix
    LOGIC: Add individual element

      for(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];
        }
      }
  9. String operations in C
    c strlen(); strrev(); strcpy(); strcat(); strcmp();

  10. WAP which reads a single letter of alphabet. If it is a lowercase between ’a’ and ’g’, the program prints out the alphabet in uppercase form. If it is anything else, the program should print out uppercase ’X’.

  11. WAP that accepts 4 real numbers from the keyboard and prints out the difference of the maximum and minimum values of these numbers using 4-decimal places.

  12. Find sin(1/x) where x != 0 upto 4 digits of precision

  13. Check for palindrom number

  14. Number of vowels in a given line
    LOGIC: Use if condition

      for(i=0;i<len;i++) {
          if(line[i] == 'a' || ......... || line[i] == 'U') {
          count++;
          }
      }
  15. Prime numbers from 1 to 100

  16. Simple Intrest

  17. Write a C program that accepts a positive integer n less than 50 from the terminal and prints out the sum 15 +25 +45 +75 +115 +_ _ _+m5, where m is less than or equal to n.

  18. Sum of digits of a positive integer less than 1000

  19. Write a C program that accepts integers from the keyboard until we enter a zero or a negative number. The program will output the number of positive values entered, the minimum value,the maximum value and the average of all numbers.

  20. Input the DOB in DDMMYYYY, find n, n is equal to the sum of digits until the sum is single digit

  21. Sum of first and last digit of an integer

  22. Armstrong Number

Go Back{: .btn}