Assignment: LAB 1
Department: CIS
Name: Abdul Rehman
Serial Number: 02
Date of submission: 02/nov/2021
Lab Assignment 1 (To be submitted)
Activity 1
Activity 3 (all three parts)
Activity 4
Activity 6
Activity 1; Write a program to print your name.
int main(){
printf("My name is Abdul rehman");
getchar();
return 0;
}
Activity 3
Write programs to solve the following problem.
1. What will be sale price of an item after 2 years if its value decreases 10%
each year? Solve this for sale price given by the user from the keyboard.
#include<stdio.h>
int main(){
int price;
printf("Enter the price");
scanf("\n%d",&price);
price=price*0.9;
price=price*0.9;
printf("\n The decreased price after 2 years is %d",price);
getchar();
return 0;
}
2. Get three integers from the user (from keyboard) and display their sum and
average.
#include<stdio.h>
int main(){
int num1,num2,num3;
printf("Enter three numbers\n");
scanf("%d\n%d\n%d",&num1,&num2,&num3);
printf("\n Sum = %d and average = %d",(num1+num2+num3),
(num1+num2+num3)/3);
getchar();
return 0;
}
3. What is 10% of 20% of 45678?
#include<stdio.h>
int main(){
int num,twenty,ten;
num=45678;
ten=num*0.1;
twenty=num*0.2;
printf("\n 10percentage of 45678 = %d and 20percentage of 45678 =
%d",ten,twenty);
getchar();
return 0;
Activity 4
Task1;
Use printf , new line character \n, tab character \t and * (stars, use shift+8 or
num‐pad to type star character) to Produce The Following Outputs Output 1
Name : (Your Name) Roll No : (Your Roll No) Session : (Your Session) Press any
key to terminate.
#include<stdio.h>
int main(){
printf("Name\t: (Your name)\nRoll no\t: (Your roll no)\nsession\t: (your
session)");
getchar;
return 0;
Task 2
#include<stdio.h>
int main(){
printf("*********\n*\t*\n*********");
getchar;
return 0;
}
Activity 6
Write code to develop the following programs. Name: Email: City: Education:
Degree/Certificate City / School / College / Univeristy Matriculation ABC School
etc Intermediate ABC College etc Graduation ABC University etc Masters ABC
University etc Work Experience (Few lines of your choice) References (Few
lines of your choice).
#include<stdio.h>
int main(){
printf("Name:\nEmail:\nCity:\n\nEducation:\t Alevels from SST\nWork
Experience\n\t I was running a tuition center from last 6 months\n");
getchar;
return 0;