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

Department of Electrical and Electronic Engineering: Assignment Submission

The document contains 3 programming assignments, including converting an equation to C code, incrementing the digits of a 5-digit number, and writing code to calculate the sum of the series 1 + 1*2 + 1*2*3 +...+ 1*2*3*..*n. Assignment 1 involves writing C code that evaluates the given equation, Assignment 2 increments each digit of a user-input 5-digit number, and Assignment 3 involves writing a for loop to calculate the sum of the series based on a user-input value of n.

Uploaded by

ShArIf AhMeD
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)
39 views8 pages

Department of Electrical and Electronic Engineering: Assignment Submission

The document contains 3 programming assignments, including converting an equation to C code, incrementing the digits of a 5-digit number, and writing code to calculate the sum of the series 1 + 1*2 + 1*2*3 +...+ 1*2*3*..*n. Assignment 1 involves writing C code that evaluates the given equation, Assignment 2 increments each digit of a user-input 5-digit number, and Assignment 3 involves writing a for loop to calculate the sum of the series based on a user-input value of n.

Uploaded by

ShArIf AhMeD
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/ 8

Department of Electrical and Electronic Engineering

Assignment Submission

Semester: Spring 2021


Course Code: CSE161
Course Title: Computer Programming

Group No: 23
Assignment No: 01

Group members:
Sl. Name Section ID In charge of
problem no.
1. Sharif 02 16121099 02
Ahmed
2. Md. 01 16321007 03
Shahriar
Nazim
3. Ishti Aadit 02 20121063 01

Date of Submission: 09.03.2021


ASSIGNMENT 02

1a.

the following equations into corresponding C statement:

7.7*b(x*y+a)/c-0.8+2*b/((x+a)*(1/y));

1b.
#include <stdio.h>
int main()
{
int x=8;
int y=2;
float a=2.5;
float b=3.2;
float c=4.6;
float A;
A=((7.7*b*(x*y+a))/(c-0.8+2*b))/((x+a)*(1/y));
printf("A=%f",A);
return 0;
}
2.
#include<stdio.h>
#include<conio.h>
void main()
{
long int a,b,c,d,e, dig1, dig2, dig3, dig4, dig5, value, new_value,temp;
printf("\n\nEnter a five digit number\n\n");
scanf("%d",&value);
dig1 = value % 10 ;
new_value = value / 10 ;
dig2 = new_value % 10 ;
new_value = new_value / 10 ;
dig3 = new_value % 10 ;
new_value = new_value / 10 ;
dig4 = new_value % 10 ;
new_value = new_value / 10 ;
dig5 = new_value % 10 ;
new_value = new_value / 10 ;
a = (dig1 + 1)%10 ;
b = (dig2 + 1)%10 ;
c = (dig3 + 1)%10 ;
d = (dig4 + 1)%10 ;
e = (dig5 + 1)%10 ;
printf("\n\nThe New Number = %d%d%d%d%d \n\n",e,d,c,b,a);
temp = e*10000+d*1000+c*100+b*10+a*1 ;
printf("\n\nThe Final Answer is = %d\n\n",temp);
getch();
}

Screenshot of the result:


3. Algorithm and flowchart of the following series 1 + 1*2 + 1*2*3 +
…. + 1*2*3*..*n
Code:
#include<stdio.h>
int main()
{
int i,N,sum,m=1;
printf("Enter the value of N: ");
scanf("%d",&N);
sum=0;
for(i=1;i<=N;i++)
{ m=m*i;
sum= sum+ m;

printf("Sum of the series is: %d\n",sum);

return 0;
}

You might also like