0% found this document useful (0 votes)
594 views3 pages

Marvellous Logic Building Asignment - 1

This document contains 5 code snippets to complete programming assignments. The snippets are for programs to divide two numbers, print a string multiple times, print a descending count, check if a number is divisible by 5, and print a number of asterisks. Users need to fill in the blanks to complete each code snippet.

Uploaded by

Saurabh Dhoke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
594 views3 pages

Marvellous Logic Building Asignment - 1

This document contains 5 code snippets to complete programming assignments. The snippets are for programs to divide two numbers, print a string multiple times, print a descending count, check if a number is divisible by 5, and print a number of asterisks. Users need to fill in the blanks to complete each code snippet.

Uploaded by

Saurabh Dhoke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Marvellous Logic Building Assignment : 1

Logic Building Assignment : 1

Complete below code snippets.


Create separate files for each application and execute it practically.
Write each program in class notebook with description.

1.Program to divide two numbers

#include<stdio.h>

____ Divide(int iNo1, int iNo2)


{
int iAns = 0;

if(ino2 ______)
{
return -1;
}

iAns = iNo1 / iNo2;

return ______;
}

int main()
{
int iValue1 = 15, iValue2 = 5;
int iRet = 0;

iRet = Divide(—————-, ————-);

printf(“Division is %d”, ————);

return 0;
}

2. Program to print 5 times “Marvellous” on screen.

#include<stdio.h>

void Display()
{
int i = 0;
for(i = 1; i<= __ ;i++)
{
printf(“Marvellous\n”);
}
}

Piyush Khairnar - 7588945488 आ"ी Technical सं&ार करतो !!! ©Marvellous Infosystems Page 1
Marvellous Logic Building Assignment : 1

int main()
{

Display();

return 0;
}

3. Program to print 5 to 1 numbers on screen.

#include<stdio.h>

______ Display()
{
int i = 0;
____ i = 5;
for( ____ ; ____ ; ____ )
{
printf(“%d”,i);
i++;
}
}

int main()
{
Display();

return 0;
}

4. Accept one number and check whether is is divisible by 5 or not.

#include<stdio.h>

typedef int BOOL;


#define TRUE 1
#define FALSE ____

______ Check( _____ iNo)


{
if(( _____ % 5) == 0)
{
return TRUE;
}
else
{
return ______ ;
}
}

Piyush Khairnar - 7588945488 आ"ी Technical सं&ार करतो !!! ©Marvellous Infosystems Page 2
Marvellous Logic Building Assignment : 1

int main()
{
int iValue = 0;
BOOL bRet = FALSE;

printf(“Enter number”);
scanf(“____” ,&____);

bRet = Check(iValue);

if(bRet == TRUE)
{
printf(“Divisible by 5”);
}
else
{
printf(“Not Divisible by 5”);
}

return 0;
}

5. Accept one number from user and print that number of * on screen.

#include<stdio.h>

void Accept(int iNo)


{
int iCnt = 0;

for( _____ ; ______ ; _____ )


{
printf(“*”)
}

int main()
{
int iValue = 0;
iValue = 5;

Accept(iValue);
return 0;
}

Piyush Khairnar - 7588945488 आ"ी Technical सं&ार करतो !!! ©Marvellous Infosystems Page 3

You might also like