Assignment Programming in C
Assignment Programming in C
}
}
7. Write the output of the following code?
int main()
{
int c=1;
while(1)
{
if (c>5) break;
printf("\t %d",c);
c++;
}
return 0;
}
8. What would be the output of the following program segment?
int k=3;
while(k<100)
{
printf(\t%d,k);
k=k*7;
}
printf("\t%d",k);
9. Write the output of the following code
int main( )
{
int i;
for(i=1; i<10; i=i+3)
printf(%d ,i);
return 0;
}
10. Write the output of the following code
void main( )
{
int i ;
for (i=89; i>0; i=i/7)
printf ("%d\t", i%7);
return 0;
}
11. Write the output of the following code
void main()
{
int x=0, i=1,j=2;
for(i=0;i<5;i++)
for(j=0;j<i;j++)
{
x+=i+j;
printtf("%d",x);
}
printf("\n%d",x);
}
f) List the different types of constants used in C. Give two examples in each type.
g) What is the purpose of a header file? Is the use of a header file absolutely
necessary?
h)
i)
j)
k)
l)
m)
n)
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34. WAP to print the following o/p on computer screen for n rows. Ex if n= 4 then
1
121
12321
1234321
35. WAP to find the smallest and largest numbers stored in an array of n numbers. N is the user
input.
36. WAP to find location of a given number in an array.
37. WAP to sort the elements in ascending order of an integer array.
38. WAP to find the Armstrong numbers (Example 153 = 13 + 5 3 + 33).
st
39.WAP to compare two integer arrays are same or not. In case of non similar print the 1
mismatched element.