Question 1.C.
# include
void main()
{
int intvalue;
char charval;
printf("Enter the value and the character:");
scanf("%d",&intvalue);
scanf("%c",&charval);
printf("the values are %d,%c",intvalue,charval);
}
-----------------------------------------------------------------------------------------------
Question 1.E.
#include
void main()
{
int x;
for(x=999;x>=1;x-=2)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 1.F.
#include
void main()
{
int count=0;
do
{
if(count%2==0)
printf("\n%d",count);
count+=2;
}
while(count<100);
}
-----------------------------------------------------------------------------------------------
Question 1.G.
#include
void main()
{
int total,x;
for(x=100;x<=150;x++)
total=total+x;
printf("%d",total);
}
..::2nd method::..
#include
void main()
{
int count,x=0;
do
{
if(x<=150 && x>=100)
count+=x;
}
while(x=x+1);
printf("\n%d",count);
}
********************************************************************
Question 4.6.a.
#include
void main()
{
int x=0;
for(x=2;x<=13;x+=2)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.6.b.
#include
void main()
{
int x=0;
for(x=5;x<=22;x+=7)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.6.c.
#include
void main()
{
int x=0;
for(x=3;x<=15;x+=3)
printf("\n%d",x);
-----------------------------------------------------------------------------------------------
Question 4.6.d.
#include
void main()
{
int x=0;
for(x=1;x<=5;x+=7)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.6.e.
# include
void main()
{
int x;
for(x=12; x>=2; x-=3)
printf("\n%d",x);
}
********************************************************************
Question 4.7.a.
#include
void main()
{
int x;
for(x=1;x<=7;x++)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.7.b.
#include
void main()
{
int x;
for(x=3;x<=23;x+=5)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.7.c.
#include
void main()
{
int x;
for(x=20;x>=-10;x-=6)
printf("\n%d",x);
}
-----------------------------------------------------------------------------------------------
Question 4.7.d.
#include
void main()
{
int x;
for(x=19;x<=51;x+=8)
printf("\n%d",x);
}
********************************************************************
Question 4.8.
#include
void main()
{
int x;
int y;
int i;
int j;
printf("Enter the colloums and rows 1-20:");
scanf("%d %d",&x,&y);
for(i=1; i<=y ; i++)
{
for(j=1;j<=x;j++)
{
printf("@");
}
printf("\n");
}
}
********************************************************************
Question 4.9.
#include
void main()
{
int value=0,total=0,i=0,num=0;
printf("How many Numbers you should want to Sum:");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
printf("Enter the Value %d :",i);
scanf("%d",&value);
total=total+value;
}
printf("Total is : %d",total);
}
********************************************************************
Question 4.11.
#include
void main()
{
int i,how,value,min;
printf("Enter How manu numbers you want to add: ");
scanf("%d",&how);
for(i=1;i<=how;i++)
{
printf("Enter the value %d :",i);
scanf("%d",&value);
if(min>value)
{
min=value;
}
}
printf("value is :%d",min);
}
********************************************************************
Question 4.12.
#include
void main()
{
int i,total=0;
for(i=2;i<=30;i+=2)
{
total=total+i;
}
printf("Total of is: %d",total);
}
********************************************************************
Question 4.13.
#include
void main()
{
int i,total;
for(i=1;i<=15;i+=2)
{
total=total*i;
}
printf("Total of is: %d",total);
}
********************************************************************
Question 4.14.
#include
void main()
{
int i,num,fact=1;
printf("give the Limit: ");
scanf("%d",&num);
for(i=1;i<=num;i++)
fact=fact*i;
printf("%d",fact);
}
********************************************************************
Question 4.16.a.
#include
void main()
{
int row,col;
for(row=1;row<=10;row++)
{
for(col=1;col<=row;col++)
{
printf("*");
}
printf("\n");
}
}
-----------------------------------------------------------------------------------------------
Question 4.16.b
#include
void main()
{
int row,col;
for(row=10;row>=0;row--)
{
for(col=1;col<=row;col++)
{
printf("*");
}
printf("\n");
}
}
********************************************************************
Question 4.17.
#include
void main()
{
int accn,cl,bl;
float new;
printf("Enter the Account Number: ");
scanf("%d",&accn);
printf("Enter the Current Balance: ");
scanf("%d",&cl);
printf("Enter the Enter the Credit Limit: ");
scanf("%d",&bl);
new=bl/2;
if(new
else
printf("you cant do the transaction");
}
********************************************************************
Question 4.18.
#include
void main()
{
int num,i,x;
for(i=0;i<5;i++)
{
printf("\nEnter the number %d :",i+1);
scanf("%d",&num);
for(x=1;x<=num;x++)
printf("*",x);
}
}
********************************************************************
Question 4.19.
#include
void main()
{
int num;
float pro,total;
printf("Enter the product type:" );
scanf("%d",&num);
switch (num)
{
case 1:
printf("Enter the Quantity:" );
scanf("%f",&pro);
total=pro*2.98;
printf("Total is:%.2f",total);break;
case 2:
printf("Enter the Quantity:" );
scanf("%f",&pro);
total=pro*4.50;
printf("Total is:%.2f",total);break;
case 3:
printf("Enter the Quantity:" );
scanf("%f",&pro);
total=pro*9.98;
printf("Total is:%.2f",total);break;
case 4:
printf("Enter the Quantity:" );
scanf("%f",&pro);
total=pro*4.49;
printf("Total is:%.2f",total);break;
case 5:
printf("Enter the Quantity:" );
scanf("%f",&pro);
total=pro*6.87;
printf("Total is:%.2f",total);break;
}
}
********************************************************************
Question 4.31.
#include
void main()
{
int row,col;
for(row=1;row<=10;row++)
{
for(col=10;col>=row;col-=2)
{
printf(" ");
}
for(col=1;col<=row;col++)
{
printf("*");
}
printf("\n");
}
for(row=10;row>=0;row--)
{
for(col=10;col>=row;col-=2)
{
printf(" ");
}
for(col=1;col<=row;col++)
{
printf("*");
}
printf("\n");
}
}
********************************************************************
Sunday, December 14, 2008
Mr.Gamidu's Model Paper Answers ( In course test)
Posted by
BADTNC
at
9:02 AM
Labels: C Programming
Subscribe to:
Post Comments (Atom)

2 comments:
he he ape first semister eke thibila giya january wala thama final exams thibbe ...ela ela niyamai..habai api bohima seemitha kotasak karey...loops and functions walin iwara una ape a subject eka..
apeth dan C karala iwarai.. hama eakama igana gannawa.. welawakata epa unath program eakak hadala run weddi nam mara sahutak thama enne!!
Post a Comment