0% found this document useful (0 votes)
245 views8 pages

Program - 1: / Write A Program To Print Your Name Using Printf Statement.

The document contains 4 programming problems and their solutions in C language. The first program prints a name using printf statement. The second program performs addition, subtraction, multiplication and division of two numbers input by the user. The third program calculates simple interest given principal, rate and time. The fourth program checks if a student passed or failed based on a marks input using an if statement.

Uploaded by

rashmi354
Copyright
© Attribution Non-Commercial (BY-NC)
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)
245 views8 pages

Program - 1: / Write A Program To Print Your Name Using Printf Statement.

The document contains 4 programming problems and their solutions in C language. The first program prints a name using printf statement. The second program performs addition, subtraction, multiplication and division of two numbers input by the user. The third program calculates simple interest given principal, rate and time. The fourth program checks if a student passed or failed based on a marks input using an if statement.

Uploaded by

rashmi354
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 8

PROGRAM 1

\* Write a program to print your name using printf() statement. *\


INPUT: #include<stdio.h> #include<conio.h> void main() { printf("My Name Is DINESH KUMAR"); getch(); }

OUTPUT: -

PROGRAM 2
\* Write a program for addition, subtraction, multiplication and division of two numbers. *\
INPUT: #include<stdio.h> #include<conio.h> void main() { int a,b,sum,sub,mul; float div; clrscr(); printf("Enter value of a"); scanf("%d",& a); printf("Enter value of b"); scanf("%d",& b); sum=a+b; sub=a-b; mul=a*b; div=a/b; printf("sum=%d",sum); printf("\nsub=%d",sub); printf("\nmul=%d",mul); printf("\ndiv=%f",div); getch(); }

OUTPUT: -

PROGRAM 3
\* Write a program to calculate simple interest. *\
INPUT: #include<stdio.h> #include<conio.h> void main() { int p,r,t; float SI; clrscr(); printf("Enter the value of p"); scanf("%d",& p); printf("Enter the value of r"); scanf("%d",& r); printf("Enter the value of t"); scanf("%d",& t); SI=p*r*t/100; printf("Simple Interest=%f",SI); getch(); }

OUTPUT: -

PROGRAM 4
\* Write a program to find whether student is Pass or not using simple if. *\
INPUT: #include<stdio.h> #include<conio.h> void main() { int marks; clrscr(); printf("Enter the marks"); scanf("%d",& marks); if(marks>=40) { printf("Pass"); } getch(); }

OUTPUT: -

You might also like