3. 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
SUBJECT MARKS ;”);
scanf(“%d”,&b);
printf(“ENTER SECOND
SUBJECT MARKS;”);
scanf(“%d”,&c);
printf(“ENTER THIRD
SUBJECT MARKS ;”);
scanf(“%d”,&d);
tot=b+c+d;
avg=tot/3;
printf(“\n\n\t\t VIDYARTHI
COMPUTERS –
HANAMAKONDA \n\n”);
printf(“\t STUDENT RNO ; %d
“,r);
printf(“\t FIRST SUBJECT
MARKS ;%d “,b);
printf(“\t SECOND SUBJECT
MARKS ;%d “,C);
printf(“\t THIRD SUBJECT
MARKS ;%d “,d);
printf(“\t AVERAGE MARKS ;
%d”, avg);
getch();
}
Back
4. 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( );
}
Back
5. Program To Read A Number And Find
Whether The Given Number Is Even Or Odd.
# include <stdio.h>
# include <conio.h>
main()
{int n,r;
clrscr();
printf(“ENTER A NUMBER ;”);
scanf(“%d”, &n);
r=n%2;
if(r= = 0)
printf(“the above given number is even
number”);
else
printf(“the above given number is odd
number”);
getch();
}
Back
6. Program to accept a year and check whether
the given year IS leap year or not.
# include <stdio.h>
# include <conio.h>
main( )
{int y;
clrscr( );
printf(“enter a year:”);
scanf(“%d”,&y);
if(y%4==0& &y%100!=0|| y%400==0);
printf(“the above given year IS a leap
year”);
else
printf(“the above given year IS not a leap
year”);
getch();
}
Back
7. Individual Digits
# include <stdio.h>
# include <conio.h>
main( )
{int a,b,c,d;
clrscr( );
printf ( “ Enter a two digit number :”);
scanf (“ %d”, &a);
b=a/10;
c=a%10;
d=b+c;
printf (“sum of individual digits of given
numbers id %”, d);
getch( );
}
Back
8. Program to accept a three digit number and
print the sum of individual digits.
# include <stdio.h>
# include <conio.h>
main( )
{int a,b,c,n, sum;
clrscr( );
printf (“ Enter a Three Digit Number:“);
scanf (“%d”,&n);
a=n/100;
b=( (n%100)/10);
c=n%10;
sum=a+b+c;
printf (“ Sum of Individual Digits of
Given Numbers is %d”, Sum);
getch( );
}
Back
9. Program to accept a number and check the
given number is Armstrong or not.
# include <stdio.h>
# include <conio.h>
main( )
{int n, a, b, c, d;
clrscr( );
printf (“ Enter a Three Digit Number: “);
scanf (“%d”, &n);
a=n/100;
b=((n/10)%10);
c=n%10;
d=a*a*a*+b*b*b +c*c*c;
if (n= =d)
printf (“The Given Number is Armstrong
number”);
else
printf (“The Given Number is Not
Armstrong number”);
getch( );
}
Back
10. Program to print ODD numbers from 1 to 10
# include <stdio.h>
# include <conio.h>
main( )
{int i;
clrscr( );
for (i=1; i<=10; i+=2)
printf(“%d\n”,i);
getch( );
}
Back
11. Program to print natural numbers from 1 to
10 in Reverse
# include <stdio.h>
# include <conio.h>
main( )
{int i;
clrscr( );
for (i=10; i>=1; i--)
printf(“%d\n”,i);
getch( );
}
Back
12. Program to print sum of the natural
numbers from 1 to 10.
# include <stdio.h>
# include <conio.h>
main( )
{int n,sum=0,i;
clrscr( );
for (i=1; i<=10; i++)
sum=sum+i;
printf(“sum of natural numbers from 1 to
10 is %d\n”,sum);
getch( );
}
Back
13. 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 u want:”);
scanf(“%d”,&t);
for (i=1; i<=10; i++)
printf(“\n%d*%d=%d”,t,i,i*t);
getch( );
}
Back
}getch( );
}
Back
45. Program to accept a string and find the
length of the given string by using functions
# include <stdio.h>
# include <conio.h>
{int i;
Back
{case ‘a’:
if(noa[i]==’ ‘) && (noa[i+1]!=’ ‘)
now++;
}noch=l-nob;
noc=noa-nov;
printf(total no of words
%d”,noc);
printf(total no of digits
%d”,nod);
getch( );
}
Back
47. Program to accept two string and compare
the strings are equal or not
# include <stdio.h>
# include <conio.h>
{int i;
{int i;
Back
48. Program to sort the entered numbers using
bubble sort.
# include <stdio.h>
# include <conio.h>
main( )
{int a[100],i,j,n,t;
Back
49. Program to read date,month, year and print
the next day’s date,month,year.
# include <stdio.h>
# include <conio.h>
main( )
{int
{if(y%400==0)
ndays=29;
}else
nm++;
{nm=1;
ny++;
}printf(“Given date is
Back
50. Program to interchange two values using
pointers.# include <stdio.h>
# include <conio.h>
int *x,*y;
{int t;
Back
51. Program to print “PASCAL TRIANGLE”.
Back
52. Program to check whether a given number is
perfect or not.
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,s=0;
Back
53. Program to check whether a given number is
prime number.
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,c=0;
Back
54. Program to read ‘n’ number and print them
in matrix terms in all orders.
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,c,p,q,r,k,a[20];
{r=i;
getch( );
}
Back
55. Program to search an element using binary
search
# include <stdio.h>
# include <conio.h>
main( )
{int a[100],i,n,x, mid, top, bot,c;
Back
56. Program to accept two numbers and print
the sum of given two numbers by using pointers
# include <stdio.h>
# include <conio.h>
main( )
{int a, b,c;
clrscr( );
Back
57. Programs to multiply two Matrices
# include <stdio.h>
# include <conio.h>
main( )
{int
for(i=1;i<m;i++)
{for(j=1;j<n;j++)
Back
58. Program to print prime number between 1-
100
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,c;
}
Back
59. Program to accept a string and find the
length of the string
# include <stdio.h>
# include <conio.h>
main( )
{char name[80];
Back
60. Program to fibanocci of matrix
main( )
{int a[10][10],i,j,m,n sum=0;
sum=sum+(a[i][j]*a[i][j])
}norm=sqrt(sum);
Back
# include <stdio.h>
# include <conio.h>
main( )
{struct student
{char name[20];
printf(“name
total
stud[i].name,stud[i].tot,stud[i].result);
}getch( );
}
Back
62. Program to find whether a square matrix is
a) symmetric b) skew symmetric c) none of two.
# include <stdio.h>
# include <conio.h>
main( )
{int a[10][10],i,j,m,n,c=0,c1=0;
c=1;
for(i=1;i<=m;i++)
{for(j=1;j<=n;j++)
}
Back
63. Program to find area of a triangle when
there sides are given.
# include <stdio.h>
# include <conio.h>
main( )
Back
64. Program to print Armstrong number
between 1-500.
clrscr( );
for(i=1;i<=500;i++)
{n=i;
printf(“\n%d”,s);
}getch();
}
Back
65. Program to check whether a given number is
Armstrong or not.
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,s,r,k;
}
Back
66. Program to print the floyd’s triangle.
# include <stdio.h>
# include <conio.h>
main( )
{int i,n,s,r k=1;
}
Back
67. Program to read data in 3 structures and
print
# include<stdio.h>
# include<conio.h>
main( )
{struct book
{char code;
Back
68. Program to print a diagonal matrix.
printf(“%d”,a[i][j]);
printf(“\n”);
}getch();
}
Back
69. Program to copy contents of one file into
another.
#include<stdio.h>
Back
#include<stdio.h>
}fcolse(fp1);
Back
a)a)
b)b)
#include<stdio.h>
{char name[20];
struct hotel ht[20],t;
for(j=0;j<n-i;j++)
{t=ht[j];
printf(“%s %s %c %d
printf(“%s %s %c %d
Back
72. Program which does the below process after
reading on odd no of integer.
a)a)
Print them in given order.
b)b)
Replace second elements by
product of first and last element
c)c)
Replace middle value by average of
all elements.
d)d)
Replace all –ve no’s by zero’s.
#include<stdio.h>
sum=sum+a[i];
}printf(“The given arrays is: “);
Back
73. Program to sort the entered elements using
selection sort technique.
pos=j;
}t=a[i];
Back
74. Program to find whether a number is
divisible by ‘11’ or not without actual division.
main( )
{int a,b,n,evensum=0,oddsum=0,div;
a=a/10;
}while(b>0)
{evensum=evensum+(b%10);
b=b/10;
}div=abs(evensum-oddsum);
11”);
getch();
}
Back
#include<stdio.h>
Back
x+x2/2!+x3/3!+------------.
#include<stdio.h>
break;
}printf(“sum=;%f’,sum);
i++;
}getch( );
}
Back
frequency
1.5
1-5
-
6.10
6-10
-
11.15
11-15
-
16.20
16-20
-
21.25
21-25
-
#include<stdio.h>
frequency”);
printf(“\n 1-5
%d”,n1);
printf(“\n 6-10
%d”,n2);
printf(“\n 11-15
%d”,n3);
printf(“\n 16-20
%d”,n4);
printf(“\n 21-25
Back
#include<stdio.h>
{int i;
for(i=0;i<=4;i++)
{printf(“enter values for a[%d]:”,i);
scanf(“%d”,&x[i]);
}}void print_array(int y[])
{int i;
{int i;
Back
#include<stdio.h>
for(i=0;i<=4;i++)
{printf(“\n%d”,*b);
b-- ;
}getch( );
}
Back
80. Program to read a string and print the
number of characters in each word of the string.
main( )
{char s[100];
{nc=0;
while(s[i]!=’ ‘)
{nc++;
printf(“\n”);
}}getch();
}
Back
81. Program to accept two strings and compare
those two strings
#include<stdio.h>
main( )
{char line [80],line2[80];
{for(;(*pt=getchar( ))!=’\n’;pt++);
*pt=’\0’;
}int strcomp (char *pt1, char *pt2)
{for(;*pt1!=’\0’;pt1++;pt2++)
Back
82. Program to accept a string using pointers
and functions.
#include<stdio.h>
#include<conio.h>
main( )
{int ch[20];
{for(;(*pt=getchar( ))!=’/n’;pt++);
*pt=’\0’;
}
Back
83.Program to read a string and print the first
two characters of each word in the string.
int i,l;
{printf(“%c %c”,s[i],s[i+1])
i=i+2;
while(s[i]!=’ ‘)
i++;
}}getch( );
}
Back
84.Program to accept two numbers and print
the sum of given two numbers by using pointers
Back
85.Program to accept a string and print reverse
of the given string by using functions.
{int 1;
{int j;
Back
b[%d][%d]:”,i,j,i,j);
scanf(“%d%d”,&a[i][j],&b[i][j]);
}printf(“\n”);
}getch( );
Back
87.Program to accept a single dimensional array
and print them by using pointers
#include<stdio.h>
#include<conio.h>
main( )
{int a[5],*b,i;
for(i=0;i<=4;i++)
{printf(“\n%d”,*b);
b++;
}getch( );
}
Back
88.Program to accept two strings and biggest
among them
{int i;
return i;
}
Back
89.Program to print 4 dimentional matrix with
constant number.
}
Back
90.Prongram to accept a string and print each
word in reverse
if(name[i]==’ ‘|| name[i]==’\n’)
{end=i;
while((end--)>=start)
Back
{int i;
for(i=0;i<10;i++)
{printf(“enter value for a[%d]”,i);
scanf(“%d”,&x[i]);
}}void sort_array(int y[])
{int i,j,k;
{int i;
Back
92.Program to accept data and store the given
data into file print the data.
if(c==eof( ))
fclose(fp);
}
Back
}fclose(fp);
fclose(fp);
}
Back
94.Program to copy contents of one file into
another.
Back
FILE *fp1,*fp2,*fp3;
scanf(“%d”,&i);
}fcolse(fp1);
Back
96.Program to accept a string in lower case and
print first character of each word in upper case.
#include<conio.h>
#include<stdio.h>
main( )
{char str1[80];
int length,i;
{
str1[0]-=32;
if(str1[i]= =’ ‘)
str1[i+1]-=32;
printf(“%c”.str1[i]);
}getch();
}int getline(char line [], int lim)
{
int i;
for(i=0;i<lim && ((line[i]=getchar( ))!
return i;
}
Back
97.Program to accept two numbers and
interchange two values using functions.
}int c;
c=a;
a=b;
Back
98.Program for example of static variable.
{printf(“\n%d”,i);
i=i+1;
}
Back
99.Program to accept a string and print by
trailing spaces.
if(n>=’a’ && n<=’z’)
putchar(n);
else
if(n>=’a’ && n<=’z’)
Back