Professional Documents
Culture Documents
LABHome Work 1
LABHome Work 1
Programing Fundamental
Department :
BSCS-ll
Roll No:
28
Submitted By :
Hamza Farooq
Submitted To :
Prof. Faheem
Punjab College Pattoki
Question # 01 :
Write a program that find the sum of first twenty odd and even
numbers.
#include <stdio.h>
void main()
{
int i, num, odd_sum = 0, even_sum = 0;
big=a[0];
for(i=0; i<size; i++)
{
if
(big<a[i])
big=a[i];
}
printf("The largest no is : %d",big);
small=a[0];
for(i=0; i>size; i++)
{
if
(small>a[i])
small=a[i];
}
printf("\nThe smallest no is: %d",small);
return 0;
}
Question # 04 :
Write a program that execute and show your university profile which
contains your name, father name, age, program and semester and
subject name.
#include <stdio.h>
int main()
{
printf(" Punjab College Pattoki \n");
printf(" Student Profile \n");
printf("Name : Hamza Farooq \n");
printf("Father Name : Afzal Farooq \n");
printf("age : Twenty one \n");
printf("program : BSCS \n");
printf("semester : Second Semester\n");
printf("subject Name : Programing Fundamental \n");
return(0);
}
Question # 05 :
Write a program that get records of five persons such as name, father,
class and age
#include<stdio.h>
int main()
{
char name,father, clas; int age;
{
printf("\n Enter name of person =" );
scanf("%s", & name);
printf("\n Enter father name of person =" );
scanf("%s", & name);
printf("\n Enter class of person =" );
scanf("%s", &clas);
printf("\n Enter age of person =" );
scanf("%d", & age);
return 0;
}}