Вы находитесь на странице: 1из 5

TRIBHUVAN UNIVERSITY

AADIKAVI BHANUBHAKTA CAMPUS

ASSIGNMENT NO:-1
Submitted by: Submitted to:
Name: Bikal Shrestha Sulove Shrestha
Subject: C Programming Subject Instructor
Roll No.: 04 Date: 2075/12/29
Faculty: BICTE Signature________
Level: 1st Semester 2075
Problem 1 : Design an algorithm and flow chart to convert temperature Fahrenheit to
Celsius.

Algorithm:
Step 1 : START
Step 2 : Input Fahrenheit
Step 3 : Celsius=(Fahrenheit-32)*5/9
Step 4 : Output Celsius
Step 5 : END

Flowchart

START

Input Fahrenheit

Celsius =(Fahrenheit-32)*5/9

Output
Celsius

END

C PROGRAMMING ASSISNGEMENT || BIKAL SHRESTHA ||


2
ROLL NO: 4 ||1ST SEM 2075
Problem 2: Design an algorithm and flow chart to find the largest value of any three
numbers.
Algorithm
Step 1 : START
Step 2 : Input a, b &c
Step 3 : if(a>b && a>c)
Output a is largest number
Else if(b>c)
Output b is largest number
Else
Output C is largest number
Step 4 : END
Flowchart

START

Input a, b & c

If b
a>b False > False
a>c c Output C is largest number

True True
Output A is largest number Output B is largest number

END

C PROGRAMMING ASSISNGEMENT || BIKAL SHRESTHA ||


3
ROLL NO: 4 ||1ST SEM 2075
Problem 3 : Write a program to input n number and sort then in descending order.
#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, dig, k, n[30];
printf("Enter how many numbers you want to enter \n");
scanf("%d", &k);
printf("Enter the numbers \n");
for (i = 0; i < k; i++)
scanf("%d", &n[i]);
for (i = 0; i < k; i++)
{ for (j = i + 1; j < k; ++j)
{ if (n[i] < n[j])
{
dig= n[i];
n[i] = n[j];
n[j] = dig;
}
}
}
printf("Given numbers in descending order are as follow \n");
for (i = 0; i < k; i++)
printf("%d\n", number[i]);
return 0;

C PROGRAMMING ASSISNGEMENT || BIKAL SHRESTHA ||


4
ROLL NO: 4 ||1ST SEM 2075
Problem 4: Write a program to input string and display 20 times.
#include<stdio.h>
#include<conio.h>

int main()
{
char str[50];
int i;
printf("Enter string :");
scanf("%s",str);
for(i=0; i<=20; i++)
{
printf("You have entered : %s\n",str);
}
return 0;
}

DECLARATION
I hereby declare that the project work entitled “C Programming Assignment ” submitted
to the Tribhuwan University Aadikavi Bhanubhakta Campus, is a record of an original
work done by me under the guidance of Mr. Sulove Shrestha, Head of IT department,
Aadikavi Bhanubhakta Campus, and this project work is submitted in the partial
fulfillment of the requirements for report submission of BICTE course. The results
embodied in this report have not been submitted to any other University or Institute for
the award of any degree or diploma.

C PROGRAMMING ASSISNGEMENT || BIKAL SHRESTHA ||


5
ROLL NO: 4 ||1ST SEM 2075

Вам также может понравиться