Professional Documents
Culture Documents
22P 9318 - Ahmed Ali
22P 9318 - Ahmed Ali
22P 9318 - Ahmed Ali
PESHAWAR CAMPUS
CL1002-PROGRAMMING FUNDAMENTALS
LAB
ASSIGNMENT #01
CODE:
include <stdio.h>
int main()
{
printf("Ahmed Ali\n");
printf("22P-9318\n");
printf("BS_SE_1-B\n");
return 0;
}
(Image on next page)
Q NO. 2:
Write a program that prints the following patterns
using “Printf” Statement:
PART-1
CODE:
#include <stdio.h>
int main()
{
printf("*****\n");
printf("*****\n");
printf("*****\n");
printf("*****\n");
printf("*****\n");
return 0;
}
PART-2
CODE:
#include <stdio.h>
int main()
{
printf("*\n");
printf("**\n");
printf("***\n");
printf("****\n");
printf("*****\n");
return 0;
}
(Image on next page)
PART-3
CODE:
#include <stdio.h>
int main()
{
printf(" *\n");
printf(" **\n");
printf(" ***\n");
printf(" ****\n");
printf("*****\n");
return 0;
}
PART-4
CODE:
#include <stdio.h>
int main()
{
printf(" *\n");
printf(" ***\n");
printf(" *****\n");
printf(" ***\n");
printf(" *\n");
return 0;
}
int Length;
int Width;
printf("Length=x\n");
printf("Width=y\n");
printf("Area=?\n");
printf("Area=Length*Width\n");
printf("put the value of length and width in above
formula,you will get the area of rectangle\n");
return 0;
}
Q No #4
Write a Program that takes the length, width,, and
height of a parallelepiped and find its volume.
CODE:
#include <stdio.h>
int main()
{
int Length;
int Width;
int Height;
printf("Length=x\n");
printf("Width=y\n");
printf("Height=z\n");
printf("Volume=?\n");
printf("Volume=Length*Width*Height\n");
printf("put the value of length,width and Height in
above formula,you will get the Volume\n");
return 0;
}
END OF ASSIGNMENT…