Post on 04-Apr-2018
7/31/2019 All Questions Txt File
1/12
Question No 1:
Write a program to find the sum of the last 3 digits of a given number.
#include
void main(){
int count, num, ld, sum=0;
printf("Enter a number:");
scanf("%d",&num);
for(count=1;count
7/31/2019 All Questions Txt File
2/12
void main()
{
int h, w, ht,wd, ch;
printf("Enter the height of the letter \"L\" to be printed: ");
scanf("%d",&ht);
printf("Enter the width of the letter \"L\" to be printed: ");scanf("%d",&wd);
printf("Enter the character to be used for printing the letter \"L\": ");
scanf("%c",&ch);
printf("\n");
for(h=1;h
7/31/2019 All Questions Txt File
3/12
for(w=1;w
7/31/2019 All Questions Txt File
4/12
for(c=1;c
7/31/2019 All Questions Txt File
5/12
Write a program to print squares of increasing size with proportionate time gap
between each box.
#include
void main(){
int j, k, c, count=10, delay, de, d;
for(c=1;c
7/31/2019 All Questions Txt File
6/12
printf("\n");
if(c==10)
for(l=count;l>=0;l--)
{
for(m=1;m
7/31/2019 All Questions Txt File
7/12
Question No 12:
Write a program to print the pattern
1
1 2
1 2 3
1 2 3 4
#include
void main()
{
int i, j;
for(i=1;i
7/31/2019 All Questions Txt File
8/12
for(j=i; j>0; j--)
{
printf("%d ",j) ;
}
printf("\n\n");
}}
Question No 14:
Write a program to print the pattern
1
1 2
1 2 3
1 2 3 4
#include
void main()
{
int i, j, k;
for(i=1;i=i;j--)
{
printf(" ");
}
for(k=1;k
7/31/2019 All Questions Txt File
9/12
the number being a 7.
#include
void main()
{
int start, end, i, temp, sum, ld;printf("\nEnter the stat value of the range:\n");
scanf("%d",&start);
printf("\nEnter the end value of the range:\n");
scanf("%d",&end);
printf("\nThe naumbers in the given range are:\n");
for(i=start;i0;)
{
ld=temp%10;
temp=temp/10;
if(ld==7)
{
printf("\t //One of the digit is a 7");
break;
}
}
printf("\n");
}
}
Question No 16:
Write a program to print all the prime numbers within a range.
#include
void main()
{
int no,counter, counter1, check, start, end, count=0;
printf("\nEnter the starting value of the range:\n");
scanf("%d",&start);printf("\nEnter the ending value of the range:\n");
scanf("%d",&end);
7/31/2019 All Questions Txt File
10/12
7/31/2019 All Questions Txt File
11/12
remainder = temp%10;
sum = sum + (remainder*remainder*remainder);
}
if ( number == sum )
{
printf("%d \n",number);count++;
}
}
if(count==0)
printf("\n\nError...!\n=========\a\a\n\n\tThere is no armstrong number
within the given range.\n\n");
}
Question No 18:
Write a program to print the sum of digits of each number in a given range (11
2 12 3 13 4.........99 18).
#include
void main()
{
int count, num, ld, sum, start, end, temp;
printf("Enter the Starting value:");
scanf("%d",&start);
printf("Enter the Ending value:");
scanf("%d",&end);
printf("The sum of the digits of each number in a given range (%d and %d) is
:\n\n",start ,end);
for(num=start; num
7/31/2019 All Questions Txt File
12/12
}