Uploaded by tonmoy01722360581

Lab-1

advertisement
CSC – 184
C Programming Lab
Report No. 1
Date of Submission: 31.10.2021
Submitted to,
Submitted by,
Nusrat Tabassum
Md. Al Imran Tonmoy
ID: 21203061
SL – 27
Department of Computer Science and Engineering
IUBAT – International University of Business Agriculture and Technology
Problem-1: Write a C program to print Hello world
#include <stdio.h>
int main()
{
printf ("Hello World");
}
OUTPUT:
Problem-2: Print an Invoice
#include <stdio.h>
int main()
{
printf ("\t\t\t Invoice\n");
printf ("\t\t\t IT BIZ COMPANY\n\n");
printf ("No.\tDesc.\tQuantity\tUnitPrice\tAmount\n");
printf ("________________________________________________________________\n");
printf ("1\t80 GB SATA\t05\t7500.00\t\t37500.00\n");
printf ("2\tIntel i5\t05\t20000.00\t100000.00\n");
printf ("3\tMicro Tower\t05\t3000.00\t\t15000.00\n");
printf ("4\t512MB RAM\t10\t2500.00\t25000.00\n");
printf ("5\tD 800 Main Board 05\t2000.00\t10000.00\n");
printf ("6\tFloppy Drive\t05\t800.00\t4000.00\n");
return 0;
}
OUTPUT:
Problem-3: Write a C program that takes two inputs and perform addition, subtraction, multiplication
and division.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,sum,sub,mul,div;
printf ("Enter first value:");
scanf ("%d",&a);
printf("Enter second value:");
scanf ("%d",&b);
sum= a+b;
sub= a-b;
mul= a*b;
div= a/b;
printf ("%d+%d=%d\n",a,b,sum);
printf ("%d-%d=%d\n",a,b,sub);
printf ("%d*%d=%d\n",a,b,mul);
printf ("%d/%d=%d\n",a,b,div);
return 0;
}
OUTPUT:
Problem-4: Write a C program to find 23 , √9, cos(0)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a=pow(2,3);
int sqrtRoot= sqrt(9);
int valueofCos= cos(0);
printf ("2 Power of 3= %d\n",a);
printf ("Square Root of 9= %d\n",sqrtRoot);
printf ("Cos(0)= %d",valueofCos);
return 0;
}
OUTPUT:
Download