You are on page 1of 2

C Programming Tutorial (II sem B.Tech.

– D section)
1. Write a C program to do the following:
a. To add and subtract to complex numbers using structures.
b. Display Prime Numbers Between Two Intervals.
c. Check Whether a Number can be Expressed as Sum of Two Prime Numbers using
functions.
2. Program to multiply two matrices
3. What would be the output of the following?
(a)
#include <stdio.h>
int main()
{
int a[3][5]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
printf("%d %d",a[2][2],a[1][7]);
return 0;
}
(b)
#include<stdio.h>
int main()
{
char p[]="abcd2011";
printf("%s",p+p[3]-p[1]);
return 0;
}
(c)
#include<stdio.h>
int f(int *a,int n)
{
if(n<=0)
return 0;
else if (*a%2==0)
return *a+f(a+1,n-1);
else
return *a-f(a+1,n-1);
}
int main()
{
int a[]={12,7,13,4,11,6};
printf("%d",f(a,6));
return 0;
}
(d)
#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
c = a == b;
printf("%d", c);
return 0;
}
4.Write a C Program to sort an array of 20 elements(elments are from 1 to 100 without
repetition) using only one loop.
5.Write a C program to print the following pattern
1
232
34543
4567654
6.Write a C Program to Convert Binary Number to Decimal and vice-versa

You might also like