0% found this document useful (0 votes)
24 views17 pages

Assignment#01 Od CP

This document contains code snippets from multiple questions in a programming assignment. Each question prints header information including the student name, registration number, course, and question number. Question 1 prints an ASCII art diagram and requests input. Question 2 converts between Fahrenheit and Celsius and requests input. Question 3 requests 10 integer values and prints whether each is even or odd. Question 4 has multiple parts that request different data types as input. Question 5 checks a number grade and prints a message.

Uploaded by

Abdullah Abid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views17 pages

Assignment#01 Od CP

This document contains code snippets from multiple questions in a programming assignment. Each question prints header information including the student name, registration number, course, and question number. Question 1 prints an ASCII art diagram and requests input. Question 2 converts between Fahrenheit and Celsius and requests input. Question 3 requests 10 integer values and prints whether each is even or odd. Question 4 has multiple parts that request different data types as input. Question 5 checks a number grade and prints a message.

Uploaded by

Abdullah Abid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

QUESTION NO #01

#include<stdio.h>
voidmain()
{

int x;

printf("/*===========================================================================
=*\n");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 01\n ");

printf("/*===========================================================================
=*\n");

printf("********* *** * \n");


printf("* * * * * * \n");
printf("* * * * * * \n");
printf("* * * * * * \n");
printf("* * * * * *\n");
printf("* * * * * * \n");
printf("* * * * * * \n");
printf("* * * * * * \n");
printf("********* *** * \n");
scanf_s(
"
%
d
"
,

&x);
}
QUESTION NO #02
#include<stdio.h>
voidmain()
{

printf("/*===========================================================================
=*\n");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 02\n ");

printf("/*===========================================================================
=*\n");
int x;
float f=72.2;
floatcelsius;
printf("enter the value of temprature==");
scanf_s("%f", &f);
celsius = 5 * (f - 32) / 9;
printf("%f", celsius);
scanf_s("%d", &x);
}
QUESTION NO # 03
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 03\n ");

printf("/*============================================================================*\n
");
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
inti;
int j;
printf("enter the 1st value==");
scanf_s("%d", &a);
printf("enter the 2st value==");
scanf_s("%d", &b);
printf("enter the 3rd value==");
scanf_s("%d", &c);
printf("enter the 4th value==");
scanf_s("%d", &d);
printf("enter the 5th value==");
scanf_s("%d", &e);
printf("enter the 6th value==");
scanf_s("%d", &f);
printf("enter the 7th value==");
scanf_s("%d", &g);
printf("enter the 8th value==");
scanf_s("%d", &h);
printf("enter the 9th value==");
scanf_s("%d", &i);
printf("enter the 10th value==");
scanf_s("%d", &j);
if (a % 2 == 0)
{
printf("the 1st no is even\n");
}
else {
printf("the 1st no is odd\n");
}
if (b % 2 == 0)
{
printf("the 2nd no is even\n");
}
else {
printf("the 2nd no is odd\n");
}
if (c % 2 == 0)
{
printf("the 3rd no is even\n");
}
else {
printf("the 3rd no is odd\n");
}
if (d % 2 == 0)
{
printf("the 4th no is even\n");
}
else {
printf("the 4th no is odd\n");
}
if (e % 2 == 0)
{
printf("the 5th no is even\n");
}
else {
printf("the 5th no is odd\n");
}
if (f % 2 == 0)
{
printf("the 6th no is even\n");
}
else {
printf("the 6th no is odd\n");
}
if (g % 2 == 0)
{
printf("the 7th no is even\n");
}
else {
printf("the 7th no is odd\n");
}
if (h % 2 == 0)
{
printf("the 8th no is even\n");
}
else {
printf("the 8th no is odd\n");
}
if (i % 2 == 0)
{
printf("the 9th no is even\n");
}
else {
printf("the 9th no is odd\n");
}

if (j % 2 == 0)
{
printf("the 10th no is even\n");
}
else {
printf("the 10th no is odd\n");
}

}
QUESTION NO #04

A)
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04\n ");

printf("/*============================================================================*\n
");

int a;
printf("entert the first integer==");
scanf_s("%d", &a);
}

B)

#include<stdio.h>
voidmain()
{
printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04\n ");

printf("/*============================================================================*\n
");

int a;
int b;
printf("entert the first integer==");
scanf_s("%d", &a);
printf("entert the first integer==");
scanf_s("%d", &b);
}

c)
#include<stdio.h>
voidmain()
{
printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04\n ");

printf("/*============================================================================*\n
");
float f;
printf("enter the float no==");
scanf_s("%f", &f);
}

D)
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04\n ");

printf("/*============================================================================*\n
");
char y;

printf("entert the first character==");


scanf_s("%d", &y);

}
E)
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04\n ");

printf("/*============================================================================*\n
");

int a;
int b;
int c;
printf("enter the first no\n");
printf("enter the secound no\n");
printf("enter the third no\n");

scanf_s("%i%i%i", &a, &b, &c);

}
QUESTION NO # 04
PART #02
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 04 part 2\n ");

printf("/*============================================================================*\n
");

charch = 'A';
charstr[20] = "fresh2refresh.com";
floatflt = 10.234;
int no = 150;
doubledbl = 20.123456;
printf("Character is %c \n", ch);
printf("String is %s \n", str);
printf("Float value is %f \n", flt);
printf("Integer value is %d\n", no);
printf("Double value is %lf \n", dbl);
printf("Octal value is %o \n", no);
printf("Hexadecimal value is %x \n", no);
}
QUESTION NO #05
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 05\n ");

printf("/*============================================================================*\n
");

int num;
printf("enter the marks of student=");
scanf_s("%d", &num);
if (num >= 90)
{
printf("obtain the A grade\n");
printf("obtain the 4.0 GPA\n");
}
elseif (num >= 80)
{
printf("obtain the B grade\n");
printf("obtain the 3.0 GPA\n");
}
elseif (num >= 65)
{
printf("obtain the C grade\n");
printf("obtain the 2.0 GPA\n");
}
elseif (num >= 50)
{
printf("obtain the D grade\n");
printf("obtain the 1.0 GPA\n");
}
elseif (num <= 50)
{
printf("obtain the F grade\n");
printf("obtain the 0.0 GPA\n");
}

}
QUESTION NO #07
#include<stdio.h>
voidmain()
{

printf("/*============================================================================*\n
");
printf("/*CSEE1122: Computer Programming\n");

printf("/*student name: Imran Akram\n");


printf("/*Registrastion No.: BEE193017\n");
printf("/*Section No.: 01\n");
printf("/*Assingment No.: 01\n");
printf("/*Question No.: 07\n ");

printf("/*============================================================================*\n
");

int x;
int units;
int cost;
intptvfee = 35;
intrealcost;
inttotalammount;
intneelamjehlamsurcharge = 60;
printf("enter the total no of units=");
scanf_s("%d", &units);
if (units <= 100)
{
cost = units * 6 + ptvfee + neelamjehlamsurcharge;
realcost = cost * 0.10;
totalammount = realcost + cost;
}
if (units >= 100 && units <= 200)
{
cost = units * 8 + ptvfee + neelamjehlamsurcharge;
realcost = cost * 0.10;
totalammount = realcost + cost;

}
if (units >= 200)
{
cost = units * 10 + ptvfee + neelamjehlamsurcharge;
realcost = cost * 0.10;
totalammount = realcost + cost;

printf("electricity bill=%d", totalammount);


scanf_s("%d", &x);
}

You might also like