Skip to main content

Posts

Showing posts with the label interview c programs

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 Print A Message.

1) Sample C Program To Print A Message. # include <stdio.h> # include <conio.h> main() { clrscr(); printf("HELLO WELCOME TO WWW.INTERVIEW-MADE-EASY.COM"); printf("Answers To All Important Interview Questions"); getch(); } 2) Sample C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. # include <stdio.h> # include <conio.h> main() { int a,b, sum; clrscr (); printf ("ENTER VALUE FOR A;"); scanf ("%d",&a); printf("ENTER VALUE FOR B;"); scanf("%d",&b); sum = a + b; printf("Sum Of Given Two Numbers are %d", sum); getch(); } 3) Sample C Program To Accept Student Roll No, Marks in 3 Subjects and Calculate Total, Average and Print it. # include <stdio.h> # include <conio.h> main() { int r, b, c, d, tot, avg; clrscr(); printf ("ENTER STUDENT RNO;"); scanf ("%d",&r); printf("ENTER FIRST SU...

C Program To Print Multiplication Table Using For Loop.

13) Sample C Program to accept a number and print mathematical table of the given no. # include <stdio.h> # include <conio.h> main( ) { int i, t; clrscr( ); printf("Which table you want:"); scanf("%d",&t); for (i = 1; i <= 10; i++)    printf("\n%d * %d = %d", t, i, i * t); getch( ); } 14) Sample C Program to print 1 to 10 mathematical tables. # include <stdio.h> # include <conio.h> main( ) { int i, j; clrscr( ); for (i = 1; i <= 10; i++)   for (j = 1; j <= 10; j++)     printf("\n%d * %d = %d", i, j, i * j); getch( ); } 15) Sample C Program to print Fibonacci series. # include <stdio.h> # include <conio.h> main( ) { int a = 0, b = 1, c = 0, i; clrscr( ); printf("%d",a); printf("\n%d",b); for (i = 1; i <= 10; i++)  {    c = a + b;    printf("\n%d", c);    a = b;    b = c;  } getch( ); }

Sample C Program To Multiply Two Matrix.

C Program To Multiply Two 3 * 3 Matrix : #include <stdio.h> #include <conio.h> #include <stdlib.h> main() { int a[3][3], b[3][3], c[3][3]; int i, j, k; clrscr(); printf(" Enter elements of first matrix \n "); for( i = 0; i < 3; i++ )   {     for( j = 0; j < 3; j++ )       {          printf(" \n Enter a[%d] [%d] eleme...