22P 9318 - Ahmed Ali

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

FAST NUCES

PESHAWAR CAMPUS

CL1002-PROGRAMMING FUNDAMENTALS
LAB

ASSIGNMENT #01

Name: AHMED ALI


ROLL NO. : 22P-9318
SECTION: BS(SE)1-B
Q NO.1:
Write a C Program to print your Name,Roll Number
& Section in seperate lines.

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;
}

(Image on next page)


Q NO #03
Write a program that calculates the Area of Rectangle
and print the result on screen.
CODE:
#include <stdio.h>
int main()
{

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…

You might also like