Skip to main content

Posts

Showing posts with the label C Programs

100 C Programs Frequently Asked in Technical Interview.

Here we bring you a collection of 100 C Programs which are frequently asked in technical interviews and semester exams.  Just click on the links given below to view the sample code. 1.  C Program To Print Welcome Message. 2.  C Program To Accept & Display A Number. 3.  C Program To Add Two Numbers. 4.  C Program To Perform Arithmetic Operations. 5.  C Program To Print Sum Of Digits In A Number. 6.  C Program To Find The Sum Of N Numbers. 7.  C Program To Print Sum Of Series 1 + 3 + 5 + …. N. 8.  C Program To Print The System Date. 9.  C Program To Swap Two Numbers Using Temporary Variables. 10.  C Program To Swap Two Numbers Without Using Temporary Variables. 11.  C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. 12.  C Program To Accept Student Roll No, Marks in 3 Subjects and Calculate Total, Average and Print it. 13.  C Program To Read Three Numbers And Print The Bigges...

Sample C Program To Delete All Vowels From A Sentence / String.

void main()   {      char sent[ ] = "She sells seashells on the seashore";      int i;      for(i = 0; sent[i] != 0; i++)        {             if(sent[i] == 97 || sent[i] == 101 || sent[i] == 105 || sent[i] == 111 || sent[i] == 117)                {                    for(;sent[i + 1] != 0; i++)                        sent[i]=sent[i + 1];                                      sent[i] = '\0';                    i =- 1;                }        }      printf("\n %s", sent);   } ALSO CHECK THESE C PROG...

Sample C Program To Count The Number Of Occurrences Of Any Two Vowels In Succession In A Line Of Text.

This program lets the user know the number of occurences of any two vowels in succession in the text passed in the program. For example, in the sentence “Please read the document carefully and then sign the gratuity form.” Such occurrences are ea, ea, ui. void main()   {      char sent[ ] = "Please read the document carefully and then sign the gratuity form.";      int i, c;      for(i = 0, c = 0; sent[ i ] != '\0'; i++)         {             if( (sent[i] == 97 || sent[i] == 101 || sent[i] == 105 || sent[i] == 117 )&&(sent[i + 1] == 97 || sent[i + 1] == 101 || sent[i + 1] == 105 || sent[i + 1] == 111 || sent[i + 1] == 117))             c++;         }      printf("\nThere are %d occurences of two vowels in succession",c);   } ALSO CHECK THESE C PROGRAMS: - C Program to count the number of wo...

Sample C Program to accept two string and compare the strings are equal or not.

46) Sample C Program to count the number of words, characters, alphabets, vowels, consonants and digit in a line of text. # include <stdio.h> # include <conio.h> main( ) { int noa = 0, nob = 0, noc = 0, nov =0 , now = 0, noch = 0, l, I; char ch, s[100]; clrscr( ); printf(" Enter 2 lines of text: "); gets(s); l = strlen(s); for(i = 0; i < 1; i++)    {       switch(s[i])         {            case 'a':            case 'e':            case 'i':            case 'o':            case 'u':            case 'A':            case 'E':            case 'I':            case 'O':            case 'U':     ...

Sample C Program to print upper triangle.

43) Sample C Program to print upper triangle. # include <stdio.h> # include <conio.h> main( ) { int a[4][4], i, j, c; clrscr( ); printf(" Enter the no. for which you want upper triangle: "); scanf("%d", &c); for(i = 0; i < 4; i++)    for(j = 0; j < 4; j++)        if(i < j)            a[i][j] = c;        else            a[i][j] = 0; for(i = 0; i < 4; i++)    for(j = 0; j < 4; j++)      {         printf("%d:", a[i][j]);         printf('\n');      } getch( ); } 44) Sample C Program to accept two 3 dimensional array and store addition of those into the third 3-D array . # include <stdio.h> # include <conio.h> main( ) { int a[3][3], b[3][3], c[3][3], i, j; clrscr( ); for(i = 0; i < 3; i++)    for(j = 0; j...

Sample C Program To Check Leap Year Using Logical Operator & Functions

C Program To Read Three Numbers And Print The Biggest Of Given Three Numbers. # include <stdio.h> # include <conio.h> main( ) {     int a, b, c, big = 0;     clrscr( );     printf("Enter Value For A:");     scanf("%d",& a);     printf("Enter Value For B:");     scanf("%d",& b);     print("Enter Value For C:");     scanf("%d",& c);     if (a > big)         big = a ;     if(b > big)         big = b;     if (c > big)         big = c;     printf (“Biggest Of Above Given Three Number Is %d”, big)     getch( ); } C Program To Find Whether The Given Number Is Even Or Odd Using Modulus Operator. # include <stdio.h> # include <conio.h> main() {     int n, r;     clrscr();     printf("Enter a ...