Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary - Cs101 (B.tech cse)

Rating
-
Sold
-
Pages
5
Uploaded on
28-02-2026
Written in
2025/2026

Programming practice learn how to make program in computer science

Institution
Course

Content preview

CS 203 Assignment 1

Answer all 4 Ques ons

1. Your friend is asking you to count the numbers that are multiples of both 3 and 5 between two given numbers
(both inclusive). You suggest writing a program to do the same where you will take two numbers as input via the
console and output the count of numbers that are multiples of both 3 and 5
Note:
Input: Two integer number greater than 0 where the first number is less than the second number
Output: Count of numbers that are multiples of both 3 and 5 between given numbers (both inclusive)
Sample input
1
15
Output
1

Input (not shown to students)
10
1000
Output
66


Ans:
#include <stdio.h>

int main() {
int num1, num2;
scanf("%d", &num1);
scanf("%d", &num2);
int i = 0,count = 0;
for (i = num1;i <= num2;i++)
{
if (i%3 ==0 && i%5 == 0)
count++;
}
prin ("%d \n",count);
return 0;
}


2. Your teacher asks you to count the number of vowels in a given word. If a vowel repeats more than once, you
need to count it only once. Write a program to do the same. You can assume all lower-case le ers, no spaces in the
word and the maximum word length to be 50 characters.
Note:
Input: Word is taken as input from the user via the console
Output: Number of unique vowel characters in the input word
Refer to the sample input and output below for an example.
Sample Input
hello
Output
2

Input (not shown to students)
university
Output
3

, Ans:
#include <stdio.h>
#include <string.h>

int main() {
char a[50];
scanf("%s", a);
int len = 0, count= 0;
len = strlen(a);
int i = 0;
int vowel[] = {0,0,0,0,0};
for (i=0;i<len;i++)
{
if (a[i] == 'a')
vowel[0]++;
else if (a[i] == 'e')
vowel[1]++;
else if (a[i] == 'i')
vowel[2]++;
else if (a[i] == 'o')
vowel[3]++;
else if (a[i] == 'u')
vowel[4]++;
}

for (i=0;i< 5;i++)
{
if (vowel[i] > 0)
{
count++;
}
}
prin ("%d \n",count);
return 0;
}


3. Write a program that accepts two 2x2 matrices of integers and prints their product which will be a 2x2 matrix of
integers.
Note:
Input: The elements of the first matrix row-wise, followed by the elements of the
second matrix, also row-wise, with one element in each line
Output: The elements of resul ng matrix, row-wise,
with the elements of each row separated by a tab
Refer to the sample input and output below for an example.
Sample Input
1
1
2
2
1
1
2
2
Output
3 3

Written for

Institution
Course

Document information

Uploaded on
February 28, 2026
Number of pages
5
Written in
2025/2026
Type
SUMMARY

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sahumahi191

Get to know the seller

Seller avatar
sahumahi191 Eklavya university
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 months
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions