Assignment-4
Assignment-4
IT SEMESTER -1
STUDENT ID :- 24BSIT094
CA-413 INTODUCTION OF PROGRAMING
PRACTICAL ASSSINGMENT – 4
WORKING WITH CHARACTERS & STRINGS
CODE:-
#include<stdio.h>
int main()
{
char x='$';
printf("The Character= %c",x);
}
OUTPUT:-
2.WRITE A PROGRAM TO PRINT CHARACTER ENTERED BY THE
USER.
CODE:-
#include<stdio.h>
int main()
{
char Z;
printf(“Enter character=”);
scanf(“%c”,&Z);
printf(“The Character you entered is %c”,Z);
OUTPUT:-
3. Write a C program to print the character string entered
by the user
CODE:-
#include<stdio.h>
int main()
char x[10];
printf("Enter character=");
scanf("%s",&x);
CODE:-
#include<stdio.h>
int main()
char c[10]="Aastha";
printf("The Character you entered is %s",c);
}
OUTPUT:-
CODE:-
#include<stdio.h>
int main()
char col_nm[10];
int num_pen;
OUTPUT:-
6. Write a C program to print Student Name, Student Roll
Number, Student City, Branch and Mobile Number entered by
the user.
CODE:-
#include<stdio.h>
int main()
char nm[20],roll[9],ct[20],branch[10],mob[10];
OUTPUT:-
7. . Write a C program to input Product ID, Product Name, per
Unit Price and Quantity. Display total bill with all the details
after applying 18% GST in a bill.
CODE:-
#include <stdio.h>
int main()
{
int quantity;
char pnm[50],pid[5];
float price,total,gst,bill;
printf("Enter Product
ID:");
scanf("%s",pid);
fflush(stdin);
printf("Enter Product
Name: ");
scanf("%s",pnm);
printf("Enter Per Unit
Price: ");
scanf("%f",&price);
printf("Enter Quantity: ");
scanf("%d",&quantity);
total=price*quantity;
gst=0.18*total; bill=total+gst;