0% found this document useful (0 votes)
12 views2 pages

Untitled Document

The document contains C programming exercises written by Anamul Hasan Nisad, a student with ID 0112510039. It includes programs for printing 'Hello World!', displaying multiple lines of text, declaring and printing variables of different types, and performing basic arithmetic operations on two integers. Each program is accompanied by its respective code implementation.

Uploaded by

coderoot32
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)
12 views2 pages

Untitled Document

The document contains C programming exercises written by Anamul Hasan Nisad, a student with ID 0112510039. It includes programs for printing 'Hello World!', displaying multiple lines of text, declaring and printing variables of different types, and performing basic arithmetic operations on two integers. Each program is accompanied by its respective code implementation.

Uploaded by

coderoot32
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/ 2

Name : Anamul Hasan Nisad

Student Id : 0112510039
Section : B

1. Write a C programming that will print “Hello World!”

#include<stdio.h>
int main()
{
printf("Hello World!");
return 0;

2. Write a C programming that will print the lines given in the sample output

#include<stdio.h>
int main()
{
printf("Hello World!\n");
printf("Welcome to C programming.\n");
printf("This is going to be fun!");
return 0;
}

3. Write a C program where you will declare an integer, a floating point and a
character variable, initialize them by values of your choice, and print these values.

#include<stdio.h>
int main()
{
int a;
float b;
char c;

printf("Enter integer value:");


scanf("%d",&a);
printf("Enter float value:");
scanf("%f",&b);
getchar();
printf("Enter a character:");
scanf("%c",&c);

printf("Integer value=%d\n",a);
printf("Floating point value=%.3lf\n",b);
printf("Character value=%c",c);

return 0;

4. Write a C program where you will declare two integer variables, initialize them by
values of your choice, and perform the basic arithmetic operations on them. The
basic arithmetic operations are addition (+), subtraction (-), multiplication (*),
division (/) and remainder (%).

#include<stdio.h>
int main()
{
int a,b,sum,sub,mul,div,rem;
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;
rem=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);
printf("%d %% %d = %d",a,b,rem);

return 0;
}

You might also like